axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam.Leggett" <>
Subject RE: Complex type in SOAP header
Date Tue, 19 Feb 2002 09:43:39 GMT
Thanks Jeff. I actually worked this out late yesterday by taking a look at
the the source for SOAPHeader and MessageElement. 
Im interested to know if you have any idea of how  this header message could
be captured in WSDL using a Java based tool. 
I know .NET can do this,  but in my case a Handler processes the SOAP Header
so its not part of my service interface(s). I fixed my generated WSDL by
manually editing it.
Thanks Again
 -----Original Message-----
From: Jeff Talbot [] 
Sent: Monday, February 18, 2002 8:07 PM
To: ''
Subject: RE: Complex type in SOAP header

You shouldn't need to deal with Element's or DOM's. Axis includes support
for complexTypes passed as SOAP Header elements (you just need to make sure
you have serializers registered for your types). On the client side you can
create the header in the following manner:

        SOAPHeader header = new SOAPHeader(NAMESPACE, localName, object); 

Then, in the service implementation (or in a handler), you can retrieve the
header in this way: 

      SOAPHeader header = env.getHeaderByName(NAMESPACE, localName); 

And the value: 

        object = header.getValueAsType(new QName(NAMESPACE, localName)); 

Hope this helps! 

> -----Original Message----- 
> From: Adam.Leggett [
<> ] 
> Sent: Monday, February 18, 2002 10:33 AM 
> To: '' 
> Subject: RE: Complex type in SOAP header 
> If anyone is interested I resolved this by simply building a 
> org.w3c.dom.Element in the client, using the  SOAPHeader(Element) 
> constructor. Then in my handler I retrieved the the 
> SOAPHeader from the 
> MessageContext and used header.getAsDOM() in order to parse 
> the contents. 
> In addition I had to manually edit the WSDL to include the 
> <soap:header> 
> details. I needed it to interop with .NET using the SOAP 
> header to carry 
> authentication credentials. .NET seems to require SOAP Header 
> details to be 
> encapsulated as a complex type. That's why I needed to build 
> the client DOM 
> and unmarshall it in the Handler. I could'nt find  a way to 
> serialize/deserialize a JavaBean in the SOAP Header that 
> encapsulated my 
> authentication details. I would prefer not to have to do it 
> in such a low 
> level way if I can. Any ideas appreciated. 
> Thanks 
> Adam 
> -----Original Message----- 
> From: Adam.Leggett [
<> ] 
> Sent: Monday, February 18, 2002 12:00 PM 
> To: Axis User ( 
> Subject: Complex type in SOAP header 
> I need to serialize a JavaBean to send in the SOAP header, 
> and to retrieve 
> it from the MessageContext in a handler. 
> I have no problem when the header element is a xsd dataype. 
> Has anyone tried this yet? 
> Adam Leggett 
> Direct Line: 0113 20 10 631 
> Fax: 0113 20 10 666 
> < <> > 
> The contents of this email are intended for the named 
> addressees and may 
> contain confidential and / or privileged material. If 
> received in error, 
> please contact UPCO on +44 (0)113 20 10 600 and then delete 
> the entire email 
> from your system. Unauthorised review, distribution, 
> disclosure or other use 
> of this information could constitute a breach of confidence. Your 
> co-operation in this matter is greatly appreciated. 

View raw message