I'm building a client application to access a web service from a 3rd party server.
From this server WSDL:
<s:element name="AuthSOAPHeader" type="tns:AuthSOAPHeader" />
<s:complexType name="AuthSOAPHeader">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="User" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" />
</s:sequence>
<s:anyAttribute />
</s:complexType>
And these commands:
wsdl2h -k -o svc.h .\svc.asmx.xml
soapcpp2 -i -C .\svc.h
My gSOAP-based client application is generating this XML:
<SOAP-ENV:Header>
<ns1:AuthSOAPHeader>
<User>user</User>
<Password>password</Password>
</ns1:AuthSOAPHeader>
</SOAP-ENV:Header>
But my server only responds to:
<SOAP-ENV:Header>
<ns1:AuthSOAPHeader xmlns="Server.WebServices">
<User>user</User>
<Password>password</Password>
</ns1:AuthSOAPHeader>
</SOAP-ENV:Header>
I'm struggling to figure out a way to add the xmlns="Server.WebServices" attribute to the AuthSOAPHeader tag. Is there a way to do this in gSOAP? Thank you in advance!
I finally fixed this by adding this flag to the soap initialization:
SOAP_XML_DEFAULTNS