Thanks :-). I didn't see that static method in MessageContext. Now it's clear.
Werner > -----Urspr�ngliche Nachricht----- > Von: Adam.Leggett [mailto:[EMAIL PROTECTED]] > Gesendet: Dienstag, 19. Februar 2002 15:11 > An: '[EMAIL PROTECTED]' > Betreff: RE: Complex type in SOAP header > > > In a Handler, where you have access to the MessageContext you > can get the > SOAP envelope like so: > > //get message from context > Message msg = msgContext.getRequestMessage(); > > //retrieve SOAP envelope > SOAPEnvelope env = > msg.getSOAPPart().getAsSOAPEnvelope(); > > From your target service you can get the MessageContext with > the static > method MessageContext.getCurrentContext(). > > Cheers > > Adam > > -----Original Message----- > From: Dittmann Werner [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 19, 2002 1:53 PM > To: '[EMAIL PROTECTED]' > Subject: AW: Complex type in SOAP header > > > Just a question: how can I access the envelope (env) in a > service? Looking > at some example I don't see where the service has access to the > envelope. > > Regards, > Werner > -----Urspr�ngliche Nachricht----- > Von: Adam.Leggett [mailto:[EMAIL PROTECTED]] > Gesendet: Dienstag, 19. Februar 2002 10:44 > An: '[EMAIL PROTECTED]' > Betreff: RE: Complex type in SOAP header > > > 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 > > Adam > > -----Original Message----- > From: Jeff Talbot [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 18, 2002 8:07 PM > To: '[EMAIL PROTECTED]' > 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 [mailto:[EMAIL PROTECTED]] > > Sent: Monday, February 18, 2002 10:33 AM > > To: '[EMAIL PROTECTED]' > > 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 [mailto:[EMAIL PROTECTED]] > > Sent: Monday, February 18, 2002 12:00 PM > > To: Axis User ([EMAIL PROTECTED]) > > 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 > > UPCO > > Direct Line: 0113 20 10 631 > > Fax: 0113 20 10 666 > > <http://www.upco.co.uk> > > 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. > > >
