axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathaniel A. Johnson" <natjo...@indiana.edu>
Subject Re: working with SOAP-Headers?
Date Sun, 05 Jun 2005 19:27:56 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ivana,

You can get the entire soap message from the MessageContext object:

MessageContext msgContext = MessageContext.getCurrentContext();

Then you can dig through it, or use the javadocs to figure out how to
get the headers (I don't remember right off hand), and find everything
in the soap request.

Nate


tht tht wrote:
> Hello,
> 
> please can someone help me by solving the following
> problem: I want to write a client-handler, which must
> add two values into a SOAPHeader e.g. "clientID" and
> "client-adress". Then, a server-handler must extract
> these two values and save them into a DB.
> 
> In the ivnoke(messageContext) method of client-handler
> I try this:
> 
> ------------------------------------------------      
>  
>  SOAPMessage msg =
> (SOAPMessageContext)messageContext.getMessage();
>  SOAPPart part = msg.getSOAPPart();
>  SOAPEnvelope envelope = part.getEnvelope();
>  SOAPHeader header = envelope.getHeader();
> 
>  SOAPHeaderElement headerElement =
> (SOAPHeaderElement)header.addHeaderElement(envelope.createName("clientID"));
>       headerElement.setActor("actor_1");
>      
> headerElement.setNamespaceURI("www.axisaccount.net/tbsg");
>       headerElement.setValue("33");
>       
>       SOAPHeaderElement headerElement2
>          =
> (SOAPHeaderElement)header.addHeaderElement(envelope.createName("client-adress"));
>      
>       
>       headerElement2.setMustUnderstand(false);
>       headerElement2.setActor("actor_2");
>      
> headerElement2.setNamespaceURI("www.axisaccount.net/tbsg");
>       headerElement2.setValue("192.168.11.1");
> -------------------------------------------------
> 
> the result is the following Header:
> 
> 
> 
>     <soapenv: Header>
>     <ns1:clientID soapenv:actor="actor_1"
> soapenv:mustunderstand="0" xsi:type="soapenc:string"
> xmlns="" xmlns:ns1="www.axisaccount.net/tbsg"
> xmlns:soapenc="http://shemas.xmlsoap.org/soap/encoding/">33</nsl:clientID>
> 
>     <ns2:client-adress soapenv:actor="actor_""
> soapenv:mustunderstand="0" xsi:type="soapenc:string"
> xmlns="" xmlns:ns2="www.axisaccount.net/tbsg"
> xmlns:soapenc="http://shemas.xmlsoap.org/soap/encoding/">192.168.11.1</nsl:client-adress>
>     </soapenv: Header>
> -----------------------------------------------
> 
> 
> Please tell me, how I can get these two
> values(clientID and client-adress) with the
> server-handler.
> 
> many thanks in advance,
> ivana
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCo1I7gj8ksIjnb2wRAq2ZAJ91AF+qZ7/+LHaRTxVwgz0n2mrbywCdGio/
jDfeGcOvBmeZUlZWY+4OwA4=
=4Mes
-----END PGP SIGNATURE-----

Mime
View raw message