axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Jordahl" <>
Subject RE: [Axis2] How to set SOAP Header ?
Date Thu, 13 Oct 2005 23:49:56 GMT

Sure seems like this is a good place for a setHeader() convenience

Let not make the AXIOM/Axis2 API hard to use just for purity sake....
Tom Jordahl

-----Original Message-----
From: Chris Lintz [] 
Sent: Thursday, October 13, 2005 5:11 PM
Subject: RE: [Axis2] How to set SOAP Header ?

 Thanks for the info.  That was close to working for me, but it appears
that way creates just an envelope wihtout the body (atleast errors
related to that were created).  Here is what I did to create header
elements that finally worked:

            OMFactory factory = OMAbstractFactory.getOMFactory();
            OMNamespace ns1 =
            OMElement clientKeyElement =
            clientKeyElement.setText( CLIENT_KEY );
            env.getHeader().addChild( clientKeyElement );

-----Original Message-----
From: Eran Chinthaka [] 
Sent: Wednesday, October 12, 2005 7:10 PM
Subject: Re: [Axis2] How to set SOAP Header ?

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
SOAPEnvelope =  fac.getDefaultSOAPEnvelope();  // this contains
Envelope, Header and the Body
soap12Envelope.getHeader().addHeaderBlock("Your Header Name",

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:

>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! 

View raw message