Generally, there is no problem in calling WebService using gsoap,
Reference http://hi.baidu.com/lbird/blog/item/0222bb6eb2eb12d480cb4a50.html
Http://www.ibm.com/developerworks/cn/webservices/ws-soa-gsoap/index.html#resources
However, if you use gsoap to call WCF, there is a problem. It is related to the service and the client soap version,
For more information, see the following link.
Http://social.msdn.microsoft.com/Forums/zh-SG/wcf/thread/1ff173ee-c371-45b1-986b-fbb67ea94de8
Http://social.msdn.microsoft.com/Forums/zh-CN/wcf/thread/082a52ea-d705-42c7-9305-3a5f7eb52367
1: Use the wsdl2h command to generate the C ++ header file
wsdl2h -s -o cert.h
2: Use soapcpp2 to generate a proxy File
soapcpp2 -C -L -w -x -i -2 -a cert.h
3: there are 6 generated files
... Namap,... proxy. cpp,... proxy. H, soapc. cpp, soaph. H, soapstub. h
The following is a brief description:
[... Namap namespace
... Proxy. cpp,... proxy. h proxy class \ header file
Soapc. cpp and soaph. h specify the serializer and deserializer of the data structure, and the modified and labeled header file generated from the input header file.
Soapstub. h: the modified and annotated header file generated from the input header file
]
4: Use vs2005 or vc6.0 (not tried) J to introduce the above files to the project, and stdsoap2.cpp and stdsoap2.h under gsoap,
5: the most important step is to modify the namespace.
For removing soap 1.2 namespace from the your web-service client project you shoshould to change strings
{"SOAP-ENV", "http://www.w3.org/2003/05/soap-envelope", "http://www.w3.org/2003/05/soap-envelope", NULL}, {"SOAP-ENC", "http://www.w3.org/2003/05/soap-encoding", "http://www.w3.org/2003/05/soap-encoding", NULL}, {"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL}, {"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL},
To
{"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", NULL, NULL}, {"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", NULL, NULL}, {"xsi", "http://www.w3.org/2001/XMLSchema-instance", NULL, NULL}, {"xsd", "http://www.w3.org/2001/XMLSchema", NULL, NULL},
In your. nsmap file and * proxy. cpp file.
The above three lines tells the client to send SOAP message
Version 1.1 instead of the default generated message version 1.2
6: The proxy class can be used as a common class for function calling. If the return value is not soap_ OK, you can use the soap_sprint_fault function for output!
_ NS3 _ getchar NS3;
_ NS3 _ getcharresponse ns3res;
Basichttpbinding_uscoreiweblogproxy weblog;
Int nret = weblog. getchar (null, null, & NS3, & ns3res );
If (nret = soap_ OK)
{
Afxmessagebox ("OK ");
}
Else
{
Cstring STR;
Char szmsg [255] = {0 };
Weblog. soap_sprint_fault (szmsg, 255 );
Str. Format ("return = % s", szmsg );
Afxmessagebox (STR );
}