Search code examples
c++web-servicesxml-namespacesgsoap

gSOAP web service respond without namespace


I'm implementing client web service from .wsdl in C++ using gSOAP library. And i have a problem, i see in tcpdump data exchange like this:

REQUEST

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://tempuri.org/" xmlns:ns2="http://xxx.pl/">
  <SOAP-ENV:Body>
    <ns1:AuthenticateUserRequest>
      <ns1:login>xxxx</ns1:login>
      <ns1:password>xxxx</ns1:password>
    </ns1:AuthenticateUserRequest>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

RESPONSE

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
    <authenticate>
      <token>xxxx</token>
      <server>xxxx</server>
    </authenticate>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

But gSOAP don't like respond without namespace (ns1 is a namespace from wsdl what i implementing) and throws me error.

SOAP 1.1 fault: SOAP-ENV:Client[no subcode]
"Validation constraint violation: tag name or namespace mismatch in element 'authenticate'"
Detail: [no detail]

What i can do with that to fix this namespace issues?

Thanks for help!


Solution

  • You should be able to give gSOAP a default namespace to use durring parsing of the responce.

    See if this link helps: http://cateof.wordpress.com/2010/09/21/default-namespace-gsoap-with/