问题
I want to use gsoap to access several web services and combine it all into 1 executable. The problem that I have is even though I do wsdl2h on multiple wsdls, and then compile the header using soapcpp2, there is only 1 proxy object generated. Here are the command line parameters that I use:
wsdl2h -o header.h -ttypemap.dat -s http://services.web.com/WebService/Service1.asmx?WSDL http://services.web.com/WebService/Service2.asmx?WSDL
soapcpp2 -pMy -i -wx -C -Igsoap-2.8/gsoap/import header.h
The problem that I get is whenever I try to access services defined in Service2 wsdl, I get exception. "System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction:
The same code that access service on Service2 works if I only compile single wsdl (only compile Service2 wsdl).
Then I check both Service1 and Service2 wsdls. They have the same "targetNamespace". That's why only 1 proxy is created.
My question is: how do I solve this problem? I need to access services on both Service1.wsdl and Service2.wsdl and put them into 1 binary.
I've read gsoap manual & tried several combination on command line parameters of wsdl2h and soapcpp2 but no luck.
Any help is much appreciated.
I use gsoap 2.8.11 btw
回答1:
This question is quite old, so I'll be very quick just to help random googlers (I found it when googling for solution to the same problem). If more details are needed, just ask.
Anyway, the solution: Use multiple calls to the wsdl2h using -q parameter (with namespace name provided) and generate unique .h file each time. Then, call soapcpp2 on each of those header files - this will generate proxy file for each of them, wrapped in namespace declaration.
来源:https://stackoverflow.com/questions/13656883/gsoap-multiple-wsdls-but-only-one-proxy-class