SOAP WSDL错误:没有与<port> </port>关联的位置

时间:2012-08-25 04:14:13

标签: php soap

我是肥皂新手,这是我第一次参与其中。通过网上的各种教程后,我已经能够创建我的第一个肥皂服务。我也被要求为它创建wsdl文件。我这样做了,但它给了我错误。

 <?xml version='1.0' encoding='UTF-8'?>
    <definitions name="FistMobileTest" targetNamespace="urn:FistMobileTest" xmlns:typens="urn:FistMobileTest" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"><message name="describe"><part name="geonameId" type="xsd:anyType"></part></message><message name="describeResponse"></message><message name="geolocate"><part name="lat" type="xsd:anyType"></part><part name="lng" type="xsd:anyType"></part></message><message name="geolocateResponse"></message>

    <portType name="my_geo_soap_wrapperPortType"><operation name="describe"><input message="typens:describe"></input><output message="typens:describeResponse"></output></operation><operation name="geolocate"><input message="typens:geolocate"></input><output message="typens:geolocateResponse"></output></operation></portType>


    <binding name="my_geo_soap_wrapperBinding" type="typens:my_geo_soap_wrapperPortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>

    <operation name="describe">
        <soap:operation soapAction="urn:my_geo_soap_wrapperAction"></soap:operation>
        <input><soap:body namespace="urn:FistMobileTest" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body></input>
        <output><soap:body namespace="urn:FistMobileTest" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body></output></operation><operation name="geolocate"><soap:operation soapAction="urn:my_geo_soap_wrapperAction"></soap:operation><input><soap:body namespace="urn:FistMobileTest" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body></input><output><soap:body namespace="urn:FistMobileTest" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"></soap:body></output></operation></binding>

    <service name="FistMobileTestService">
    <port name="my_geo_soap_wrapperPort" binding="typens:my_geo_soap_wrapperBinding">
    <soap:address></soap:address></port>
    </service>


    </definitions>

这就是我的类文件的样子:

    <?php
class my_geo_soap_wrapper
{
    private $my_geo_app;

    public function set_geo_app($tmp_my_geo_app)
    {
        $this->my_geo_app = $tmp_my_geo_app;
    }

    //should return long
    public function geolocate(double $lat, double $lng)
    {
        return $this->my_geo_app->geolocate($lat,$lng);
    }

    //should return array
    public function describe(long $geonameId)
    {
        return $this->my_geo_app->describe($geonameId);
    }

    public function initiate()
    {

        //start server

        $server = new SoapServer('firstmobile.wsdl', array('uri' => "urn://localhost/firstmobile"));
        $server->setObject($this);
        $server->handle();

    }

}
?>

我得到的错误:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>WSDL</faultcode>
<faultstring>
SOAP-ERROR: Parsing WSDL: No location associated with <port>
</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

1 个答案:

答案 0 :(得分:0)

您是否尝试使用正确的端口设置端点?

<service name="FistMobileTestService">
<port name="my_geo_soap_wrapperPort" binding="typens:my_geo_soap_wrapperBinding">
<soap:address location="http://localhost:8080/test.wsdl></soap:address></port>
</service>