私は石鹸に不慣れで、これに取り組むのはこれが初めてです。ネットでさまざまなチュートリアルを行った後、初めての 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>