Reputation: 2697
I have noticed a few people have asked this question but I haven't been able to find a satisfactory answer. I am using gSOAP to create c++ stubs from a wsdl document. The problem is gSOAP is prefixing the namespace to the soap method names when sending a soap message. For example it is sending <ns2:Inform></ns2:Inform>
when It needs to be sending <Inform></Inform>
Does anyone know how to resolve this issue?
EDIT:
The selected answer below didn't work for me at first because I am using the c++ proxy version but all I had to do was create my service object using the following code,
exampleSOAPProxy service=exampleSOAPProxy(SOAP_XML_DEFAULTNS,SOAP_XML_DEFAULTNS);
SOAP_XML_DEFAULTNS is a confusing name because it doesn't actually use the default namespace for everything it just removes namespace prefixes from the elements and adds the namespace explicitly to each element.
When compiling my application I needed to add -DWITH_SOAPDEFS_H to my compile/link statement. Note I needed to create a file called soapdefs.h in /usr/local/include/ because it gets imported when you set the -DWITH_SOAPDEFS_H flag. Its just a header file that you use to add includes and declareations to stdsoap2.h
Upvotes: 2
Views: 5207
Reputation: 46
Which version of gSOAP do you use? If it's 2.8.1 or higher you can try using this:
soap_omode(&soap, SOAP_XML_DEFAULTNS);
I found it on http://cateof.wordpress.com/2010/09/21/default-namespace-gsoap-with/
Upvotes: 3