我嘗試使C++代理形成多個WSDL,但生成的代理類具有錯誤的端點。在代理類的每個方法結果端點是加入像值:具有多個WSDL的gSoap
soap_endpoint = "http://endpoint1 http://endpoint2 etc".
運行後:
wsdl2h.exe -o out\wsdl.h -t typemap.dat service1.wsdl service2.wsdl
結果wsdl.h具有行:
//gsoap booking service name: ricercaRichiestaSoap11
//gsoap booking service type: ricercaRichiesta
//gsoap booking service port: http://e-servizicoll.apps.dtt:80/PrenotaPatente-ws/services/ricercaRichiestaEsame/
//gsoap booking service port: http://e-servizicoll.apps.dtt:80/PrenotaPatente-ws/services/stampaFoglioRosa/
//gsoap booking service namespace: http://www.dtt.it/xsd/PrenotaPatenteWS
//gsoap booking service transport: http://schemas.xmlsoap.org/soap/http
此命令後:
soapcpp2.exe -C -L -dout -j -x -I gsoap\import out\wsdl.h
它產生有兩種方法ricercaRichiestaSoap11Proxy類,但他們已經加入了終點:
soap_endpoint = "http://e-servizicoll.apps.dtt:80/PrenotaPatente-ws/services/ricercaRichiestaEsame/ http://e-servizicoll.apps.dtt:80/PrenotaPatente-ws/services/stampaFoglioRosa/";
如何解決這個問題?也許我必須使用不同的工作流程來生成代理或手動編輯生成的wsdl.h? 謝謝。
我在win7 x64上使用gSoap 2.8.17。
service1.wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:sch="http://www.dtt.it/xsd/PrenotaPatenteWS"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.dtt.it/xsd/PrenotaPatenteWS"
targetNamespace="http://www.dtt.it/xsd/PrenotaPatenteWS">
<wsdl:types> .... </wsdl:types>
<wsdl:message name="ricercaRichiestaEsameResponse">
<wsdl:part element="tns:ricercaRichiestaEsameResponse" name="ricercaRichiestaEsameResponse" />
</wsdl:message>
<wsdl:message name="ricercaRichiestaEsameRequest">
<wsdl:part element="tns:ricercaRichiestaEsameRequest" name="ricercaRichiestaEsameRequest" />
</wsdl:message>
<wsdl:portType name="ricercaRichiesta">
<wsdl:operation name="ricercaRichiestaEsame">
<wsdl:input message="tns:ricercaRichiestaEsameRequest" name="ricercaRichiestaEsameRequest" />
<wsdl:output message="tns:ricercaRichiestaEsameResponse" name="ricercaRichiestaEsameResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ricercaRichiestaSoap11" type="tns:ricercaRichiesta">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="ricercaRichiestaEsame">
<soap:operation soapAction="" />
<wsdl:input name="ricercaRichiestaEsameRequest">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="ricercaRichiestaEsameResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ricercaRichiestaService">
<wsdl:port binding="tns:ricercaRichiestaSoap11" name="ricercaRichiestaSoap11">
<soap:address location="http://e-servizicoll.apps.dtt:80/PrenotaPatente-ws/services/ricercaRichiestaEsame/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
服務2。WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:sch="http://www.dtt.it/xsd/PrenotaPatenteWS"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.dtt.it/xsd/PrenotaPatenteWS"
targetNamespace="http://www.dtt.it/xsd/PrenotaPatenteWS">
<wsdl:types> .... </wsdl:types>
<wsdl:message name="stampaFoglioRosaResponse">
<wsdl:part element="tns:stampaFoglioRosaResponse" name="stampaFoglioRosaResponse" />
</wsdl:message>
<wsdl:message name="stampaFoglioRosaRequest">
<wsdl:part element="tns:stampaFoglioRosaRequest" name="stampaFoglioRosaRequest" />
</wsdl:message>
<wsdl:portType name="stampaFoglioRosa">
<wsdl:operation name="stampaFoglioRosa">
<wsdl:input message="tns:stampaFoglioRosaRequest" name="stampaFoglioRosaRequest" />
<wsdl:output message="tns:stampaFoglioRosaResponse" name="stampaFoglioRosaResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="stampaFoglioRosaSoap11" type="tns:stampaFoglioRosa">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="stampaFoglioRosa">
<soap:operation soapAction="" />
<wsdl:input name="stampaFoglioRosaRequest">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="stampaFoglioRosaResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="stampaFoglioRosaService">
<wsdl:port binding="tns:stampaFoglioRosaSoap11" name="stampaFoglioRosaSoap11">
<soap:address location="http://e-servizicoll.apps.dtt:80/PrenotaPatente-ws/services/stampaFoglioRosa/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
爲什麼不在所有的WSDL上一起運行wsdl2h?然後在獲得的.h文件中使用soapcpp2選項-j爲每個WSDL服務生成代理和服務類。總是像魅力一樣工作。 – 2017-07-05 15:19:50