Hi There
At the client side u can instatiate a Stub
Object from the org.apache.axis.client and use
a method setHeader() to set the Header of an out going
SOAP Message, I mean request Message.
At the server side do this :
MessageContext msgContext = MessageContext.getCurrentContext();
Message reqMsg =
msgContext.getRequestMessage(); // Gets the
SOAPNevelope for the Request
Message SOAPEnvelope soapEnv=
reqMsg.getSOAPEnvelope(); // Gets the SOAPHeader for the Request
Message SOAPHeader soapHead=
(org.apache.axis.message.SOAPHeader)soapEnv.getHeader(); // Gets
all the SOAPHeaderElements into an Iterator Iterator itrElements=
soapHead.getChildElements();
Iterate through this iterator to extract each Child
element of the Header.
Hope this helps.
Cheers
Dhanush
----- Original Message -----
Sent: Tuesday, June 01, 2004 12:02
AM
Subject: Populating SOAPHeader and
SOAPBody.
Hello,
I would like to have
some advices / comments about populating SOAPHeader and SOAPBody of a
SOAPEnvelope (org.apache.axis.message.*).
I have a web service that
receives a SOAPEnvelope, and saves its SOAPHeader and SOAPBody parts to a
database (as String). At a later time, when another SOAP-request comes in,
the web service gets the String-values from database, and populates the
SOAPEnvelope with them.
I am wondering, what is the easiest/best/right
way to populate the SOAPHeader and SOAPBody of the SOAPEnvelope when they
are already represented as Strings?
For example, if the
SOAPHeader-part is saved as following in the database, how should I insert
it to a SOAPEnvelope?
<SOAP-ENV:Header>
<ar:MessageHeader
SOAP-ENV:mustUnderstand="1">
<ar:From>
<ar:PartyId>ID
1</ar:PartyId>
<ar:Role>requester</ar:Role>
</ar:From>
<ar:To>
<ar:PartyId>ID
1</ar:PartyId>
<ar:Role>responder</ar:Role>
</ar:To> </ar:MessageHeader
SOAP-ENV:mustUnderstand="1"> </SOAP-ENV:Header>
~
Ilari Kontinen
*********************************************************
Disclaimer:
This message (including any attachments) contains
confidential information intended for a specific
individual and purpose, and is protected by law.
If you are not the intended recipient, you should
delete this message and are hereby notified that
any disclosure, copying, or distribution of this
message, or the taking of any action based on it,
is strictly prohibited.
*********************************************************
Visit us at http://www.mahindrabt.com
|
|