Web Services WSDL错误:SOAP错误:正在解析WSDL:无法绑定到服务

rlcwz9us  于 2022-11-15  发布在  其他
关注(0)|答案(2)|浏览(215)
<?xml version="1.0" encoding="UTF-8"?>
<definitions
    xmlns="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://localhost:8888/testes/wsdl/calculadora.wsdl">
    <message name="requisicaoSoma">
        <part name="x" type="xsd:int" />
        <part name="y" type="xsd:int" />
    </message>
    <message name="respostaSoma">
        <part name="z" type="xsd:int" />
    </message>
    <portType name="calculadoraPortType">
        <operation name="soma">
            <input message="requisicaoSoma" />
            <output message="respostaSoma" />
        </operation>
    </portType>
    <binding name="calculadoraBinding" type="tns:calculadoraPortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
        <operation>
            <soap:operation soapAction="http://localhost:8888/testes/calculadora.php" />
            <input><soap:body use="literal" /></input>
            <output><soap:body use="literal" /></output>
        </operation>
    </binding>
</definitions>

我错过了什么吗?谢谢。

ahy6op9u

ahy6op9u1#

您尚未定义WSDL的服务元素。有关详细信息,请参阅以下链接。
WSDL Essentials
Sample WSDL

gwo2fgha

gwo2fgha2#

正确的wsdl如下所示。
注意

  • 在顶部定义名称
  • 底部的服务部分(假定的服务URL-最高为Web服务器配置)
<definitions
    name="calculadora"
    xmlns="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://localhost:8888/testes/wsdl/calculadora.wsdl">
    <message name="requisicaoSoma">
        <part name="x" type="xsd:int" />
        <part name="y" type="xsd:int" />
    </message>
    <message name="respostaSoma">
        <part name="z" type="xsd:int" />
    </message>
    <portType name="calculadoraPortType">
        <operation name="soma">
            <input message="requisicaoSoma" />
            <output message="respostaSoma" />
        </operation>
    </portType>
    <binding name="calculadoraBinding" type="tns:calculadoraPortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
        <operation>
            <soap:operation soapAction="http://localhost:8888/testes/calculadora.php" />
            <input><soap:body use="literal" /></input>
            <output><soap:body use="literal" /></output>
        </operation>
    </binding>
    
    <wsdl:service name="CalculadoraService">
        <wsdl:port binding="tns:calculadoraPortType" name="calculadoraBinding">
            <soap:address location="http://localhost:8888/CalculadoraService"/>
        </wsdl:port>
    </wsdl:service>

</definitions>

相关问题