You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by local-underground <lo...@yahoo.com> on 2005/10/12 23:00:14 UTC

[Axis2] How to set SOAP Header ?

Hi,
I am trying to figure out what has changed in terms of how I can now set a SOAP Header in
Axis2.  Does any one know how to do so?

  Here is my envelope:    env = createEnvelope();

But there is no setHeader(String, String) function.  I can get the header, but its not
apparent how to successfully set a header.

thanks for any help



		
__________________________________ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs

Re: [Axis2] How to set SOAP Header ?

Posted by Eran Chinthaka <ch...@opensource.lk>.
Hi "Local-Underground" ,

Axis2 has its "native" xml object model called Axiom. We represent the 
SOAP message using that.
Every SOAP element extends from OMElement.

So if you want to set a header the easiest way is like this:

SOAPFactory fac = OMAbstractFactory.getSOAP11Factory(); // or 
getSOAP12Factory()
SOAPEnvelope =  fac.getDefaultSOAPEnvelope();  // this contains 
Envelope, Header and the Body
soap12Envelope.getHeader().addHeaderBlock("Your Header Name", OMNamespace)

If you want more info on AXIOM, read the OM (AXIOM is also referred to 
as OM within Axis2 dev team) tutorial found in Axis2 site, or there will 
be couple of other tutorials on the web.

-- Chinthaka


local-underground wrote:

>Hi,
>I am trying to figure out what has changed in terms of how I can now set a SOAP Header in
>Axis2.  Does any one know how to do so?
>
>  Here is my envelope:    env = createEnvelope();
>
>But there is no setHeader(String, String) function.  I can get the header, but its not
>apparent how to successfully set a header.
>
>thanks for any help
>
>
>
>		
>__________________________________ 
>Start your day with Yahoo! - Make it your home page! 
>http://www.yahoo.com/r/hs
>
>
>  
>