只有 "hello" 函数在我的 WSDL 中工作

Only "hello" function working in my WSDL

在我的 Symfony 服务器上设置网络服务,我遵循以下指南: https://symfony.com/doc/current/controller/soap_web_service.html 给出的示例运行良好,具有此问候功能:

public function hello($name)
{
    return 'Hello, '.$name;
}

所以我尝试用这个再见功能来完成这个网络服务:

public function bye($name)
{
    return 'Goodbye, '.$name;
}

这是我的 wsdl:

<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:tns="urn:arnleadservicewsdl"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    targetNamespace="urn:helloservicewsdl">

    <types>
        <xsd:schema targetNamespace="urn:hellowsdl">
            <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
            <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
        </xsd:schema>
    </types>

    <message name="helloRequest">
        <part name="name" type="xsd:string" />
    </message>

    <message name="helloResponse">
        <part name="return" type="xsd:string" />
    </message>

    <message name="byeRequest">
        <part name="name" type="xsd:string" />
    </message>

    <message name="byeResponse">
        <part name="return" type="xsd:string" />
    </message>

    <portType name="hellowsdlPortType">
        <operation name="hello">
            <documentation>Hello World</documentation>
            <input message="tns:helloRequest"/>
            <output message="tns:helloResponse"/>
        </operation>

        <operation name="bye">
            <documentation>Goodbye World</documentation>
            <input message="tns:byeRequest"/>
            <output message="tns:byeResponse"/>
        </operation>
    </portType>

    <binding name="hellowsdlBinding" type="tns:hellowsdlPortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="hello">
            <soap:operation soapAction="urn:arnleadservicewsdl#hello" style="rpc"/>

            <input>
                <soap:body use="encoded" namespace="urn:hellowsdl"
                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>

            <output>
                <soap:body use="encoded" namespace="urn:hellowsdl"
                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
        <operation name="bye">
            <soap:operation soapAction="urn:arnleadservicewsdl#bye" style="rpc"/>

            <input>
                <soap:body use="encoded" namespace="urn:hellowsdl"
                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>

            <output>
                <soap:body use="encoded" namespace="urn:hellowsdl"
                    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
    </binding>

    <service name="hellowsdl">
        <port name="hellowsdlPort" binding="tns:hellowsdlBinding">
            <soap:address location="http://10.0.0.42/esi/soap" />
        </port>
    </service>
</definitions>

Hello 函数仍然有效,但每次我调用 bye 函数时,我都会得到一个错误:

Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML

我哪里错了?

好的,首先我在 https://www.wsdl-analyzer.com/ 的帮助下重写了我的 WSDL。这是我的新 WSDL:

<?xml version="1.0" encoding="ISO-8859-1"?>
<wsdl:definitions name="helloServiceController"
             targetNamespace="urn:helloServiceControllerwsdl"
             xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:tns="urn:helloServiceControllerwsdl">
    <wsdl:types>
        <xsd:schema targetNamespace="urn:helloServiceControllerwsdl">
            <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
            <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="helloRequest">
        <wsdl:part name="name" type="xsd:string"/>
    </wsdl:message>
    <wsdl:message name="helloResponse">
        <wsdl:part name="return" type="xsd:string"/>
    </wsdl:message>
    <wsdl:message name="byeRequest">
        <wsdl:part name="name" type="xsd:string"/>
    </wsdl:message>
    <wsdl:message name="byeResponse">
        <wsdl:part name="return" type="xsd:string"/>
    </wsdl:message>
    <wsdl:portType name="helloServicePortType">
        <wsdl:operation name="hello">
            <wsdl:documentation>Hello World</wsdl:documentation>
            <wsdl:input message="tns:helloRequest"/>
            <wsdl:output message="tns:helloResponse"/>
        </wsdl:operation>
        <wsdl:operation name="bye">
            <wsdl:documentation>Bye World</wsdl:documentation>
            <wsdl:input message="tns:byeRequest"/>
            <wsdl:output message="tns:byeResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="helloServiceBinding" type="tns:helloServicePortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="hello">
            <soap:operation soapAction="urn:helloServiceControllerwsdl#hello" style="rpc"/>
            <wsdl:input>
                <soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="bye">
            <soap:operation soapAction="urn:helloServiceControllerwsdl#bye" style="rpc"/>
            <wsdl:input>
                <soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="helloService">
        <wsdl:port name="helloServicePort" binding="tns:helloServiceBinding">
            <soap:address location="http://10.0.0.42/esi/soap"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

之后还是不行,连hello功能都不行。扯了一会头发,干脆重启我的服务器就好了。可能是缓存问题!