0

我是肥皂新手,这是我第一次研究它。在通过网络上的各种教程后,我已经能够创建我的第一个肥皂服务。我还被要求为其创建 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>
4

1 回答 1

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>
于 2012-08-25T04:39:33.190 回答