You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jason Rousell <jr...@i2q.co.uk> on 2004/06/23 13:51:22 UTC
How can I add an additional namespace to envelope from WSDL2Java client code
Hi,
I'm still trying to get to grips with axis and have got completely
stuck. I have run WSDL2Java on a remote WSDL, successfully created
client code to make the call.
However, the remote service requires the use of soap headers. I've
managed to add these okay by getting a stub object and using the
setHeader() method.
But, the request fails because the header section does not use the
correct namespace. Which has led me to think that I need to add the
required namespace to the opening envelope tag.
I've searched the wiki and this list but can't seem to find an answer.
I create the service etc. like this:
// Use service interface to attache to serach locator
colsearch.ws.Search service = new colsearch.ws.SearchLocator();
// Now use the service to get a stub which implements the SDI.
colsearch.ws.SearchSoap col = service.getSearchSoap();
//prepare a stub for adding headers
org.apache.axis.client.Stub s = (Stub) col;
I've tried using MessageContext.getMessage() but it fails. From what
I've read it seems as though this doesn't work with stub generated
client code.
When I manually edit the axis generated soap xml and try it in soapscope
it works, so I know it's to do with the missing namespace.
So, is there a way that anybody knows of getting hold of the envelope to
add another namespace?
Any help would be much appreciated as I'm totally stuck right now.
Thanks
Jason