SOAP Header and field additional information
Can we send some additional Header information in a standard SOAP message. Yeah, we can. Sending the Header information in a SOAP message is a smart way of programing. Through this scenario we can clearly distinguish the processing inputs for the actual business logic and the supporting/utility inputs for a service, in the SOAP message. If you have a close lookup in the WS-Addressing there are using similar technique to give the flexibility to provides the transport-neutral mechanisms to address Web services and messages.
In our scenario we are going to send some additional, but not directly involved in a business logic processing, inputs values in the Header of the SOAP message.
For example, we are interesting to identify the source of the location from where the SOAP request was originated. For that we have a unique application ID for each WS client must have to send along with the SOAP message, but this Application ID is
actually no needed for the business logic processing. Just to track the Client application. So what we can do is, we can differentiate the Body of the SOAP message to the business logic inputs and we can send the required application ID in the Header section of the SOAP message.
This is the soap message we are going to send to the WS server. Just have a look at the SOAP message, specify in the Header section.
<env:Header><tns:appId>A21313SDF</tns:appId></env:Header>
Alright, The next question is how can we define this header information in the WSDL service contract! Have a look at this shots.
This are the additional fields in the normal WSDL contract. Then by using the Apache CXF, you can easy create the related java classes with this WSDL. For your convenient, I have attached the services Implementation class and WSDL. have a look at get the idea.
Resources :
Person WSDL File
All Related Java Files-Including Generated Class
This Articles was posted on 8:59 PMMonday, January 18, 2010
|
Labels:
Java,
SOAP,
Wep services,
WSDL
|
0 comments:
Post a Comment