I am woking on windows platform, gSoap is working fine but it integrates complex type defination in the soap message.
How to remove these complex type definition from soap message
xsi:type="ns4:MYServerRequestDto"
xsi:type="ns4:MySettingDto"
how to regenerate gsoap files so it will not include type information?
<?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:ns5="http://schemas.datacontract.org/2004/07/System.IO" xmlns:ns6="http://schemas.datacontract.org/2004/07/System" xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:ns4="http://schemas.datacontract.org/2004/07/MYServer.Utils" xmlns:ns1="http://tempuri.org/" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<SOAP-ENV:Body>
<ns1:Register>
<ns1:request xsi:type="ns4:MYServerRequestDto">
<ns4:SerialNumber>2</ns4:SerialNumber>
<ns4:MySetting xsi:type="ns4:MySettingDto">
<ns4:AVersion>2</ns4:AVersion>
<ns4:BVersion>2</ns4:BVersion>
</ns4:MYSetting>
<ns4:IPAddress>192.168.1.199</ns4:IPAddress>
</ns1:request>
</ns1:Register>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
If you are using proxy generated by gSOAP tools, then you need to set output mode of the proxy with SOAP_XML_NOTYPE flag.
It can be done in two ways:
In one place in the init function of the proxy itself, but then every time proxy is generated it will be overwritten.
void nsTestBindingProxy::nsTestBindingProxy_init(soap_mode imode, soap_mode omode) { omode |= SOAP_XML_NOTYPE; //removes xsi:type soap_imode(this->soap, imode); soap_omode(this->soap, omode); soap_endpoint = NULL; ... }
After every initialization of the proxy in code by calling soap_omode function
nsTestBindingProxy proxy(); soap_omode(proxy.soap, proxy.soap->omode | SOAP_XML_NOTYPE);
来源:https://stackoverflow.com/questions/26097664/how-to-remove-xsitype-information-from-gsoap-message