我在 PHP 中的 SOAP 客户端有问题,我认为我的请求是正确的。
我的 PHP 客户端 SOAP:
$soapURL = "http://mylink.fr/mywsdl?wsdl";
$soapParameters = Array('login' => "MyLogin", 'password' => "MyPassword", 'trace' => 1);
try {
$service=new SoapClient($soapURL, $soapParameters);
$request = array(
'address' => array(
'city' => '',
'country' => '',
'department' => '',
'district' => '',
'houseNumber' => '',
'region' => '',
'road' => '',
'roadNumber' => '',
'zipCode' => ''
),
'category' => array(
'logo' => '',
'name' => '',
'reference' => ''
),
'companyName' => '',
'contactMail' => '',
'contactName' => '',
'contactPhone' => '',
'endTemporary' => '2015-02-15T13:00:10',
'latitude' => 12.0,
'longitude' => 12.0,
'name' => '',
'radius' => 520,
'reference' => '',
'startTemporary' => '2015-02-15T13:00:11',
'temporary' => 0
);
$result = $service->createPOI($request);
} catch(SoapFault $e) {
echo $service->__getLastRequest();
echo $e->__toString();
}
我的 SOAP 请求:
<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.webservices.masternaut.fr/MasterWS/services/POI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:POI" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/">
<soap-env:body>
<ns1:createpoi>
<poi xsi:type="ns2:POI">
<address xsi:type="ns2:Address">
<city xsi:type="xsd:string"></city>
<country xsi:type="xsd:string"></country>
<department xsi:type="xsd:string"></department>
<district xsi:type="xsd:string"></district>
<housenumber xsi:type="xsd:string"></housenumber>
<region xsi:type="xsd:string"></region>
<road xsi:type="xsd:string"></road>
<roadnumber xsi:type="xsd:string"></roadnumber>
<zipcode xsi:type="xsd:string"></zipcode>
</address>
<category xsi:type="ns2:PoiCategory">
<logo xsi:type="xsd:string"></logo>
<name xsi:type="xsd:string"></name>
<reference xsi:type="xsd:string"></reference>
</category>
<companyname xsi:type="xsd:string"></companyname>
<contactmail xsi:type="xsd:string"></contactmail>
<contactname xsi:type="xsd:string"></contactname>
<contactphone xsi:type="xsd:string"></contactphone>
<endtemporary xsi:type="xsd:dateTime">2015-02-15T13:00:10</endtemporary>
<latitude xsi:type="xsd:double">12</latitude>
<longitude xsi:type="xsd:double">12</longitude>
<name xsi:type="xsd:string"></name>
<radius xsi:type="xsd:int">520</radius>
<reference xsi:type="xsd:string"></reference>
<starttemporary xsi:type="xsd:dateTime">2015-02-15T13:00:11</starttemporary>
<temporary xsi:type="xsd:boolean">false</temporary>
</poi>
<overwrite xsi:nil="true"></overwrite>
</ns1:createpoi>
</soap-env:body>
</soap-env:envelope>
WSDL:
<complexType name="PoiCategory">
<sequence>
<element name="logo" nillable="true" type="xsd:string"/>
<element name="name" nillable="true" type="xsd:string"/>
<element name="reference" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="Address">
<sequence>
<element name="city" nillable="true" type="xsd:string"/>
<element name="country" nillable="true" type="xsd:string"/>
<element name="department" nillable="true" type="xsd:string"/>
<element name="district" nillable="true" type="xsd:string"/>
<element name="houseNumber" nillable="true" type="xsd:string"/>
<element name="region" nillable="true" type="xsd:string"/>
<element name="road" nillable="true" type="xsd:string"/>
<element name="roadNumber" nillable="true" type="xsd:string"/>
<element name="zipCode" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="POI">
<sequence>
<element name="address" nillable="true" type="tns1:Address"/>
<element name="category" nillable="true" type="tns1:PoiCategory"/>
<element name="companyName" nillable="true" type="xsd:string"/>
<element name="contactMail" nillable="true" type="xsd:string"/>
<element name="contactName" nillable="true" type="xsd:string"/>
<element name="contactPhone" nillable="true" type="xsd:string"/>
<element name="endTemporary" nillable="true" type="xsd:dateTime"/>
<element name="latitude" type="xsd:double"/>
<element name="longitude" type="xsd:double"/>
<element name="name" nillable="true" type="xsd:string"/>
<element name="radius" type="xsd:int"/>
<element name="reference" nillable="true" type="xsd:string"/>
<element name="startTemporary" nillable="true" type="xsd:dateTime"/>
<element name="temporary" type="xsd:boolean"/>
</sequence>
</complexType>
<wsdl:portType name="PoiWS">
<wsdl:message name="createPOIRequest">
<wsdl:part name="poi" type="tns1:POI"></wsdl:part>
<wsdl:part name="overwrite" type="xsd:boolean"></wsdl:part>
</wsdl:message>
<wsdl:message name="createPOIResponse">
<wsdl:part name="createPOIReturn" type="xsd:int"></wsdl:part>
</wsdl:message>
</wsdl:portType>
<wsdl:binding name="POISoapBinding" type="impl:PoiWS">
<wsdl:operation name="createPOI">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="createPOIRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://mylink.fr/wsdl" use="encoded"/>
</wsdl:input>
<wsdl:output name="createPOIResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://mylink.fr/wsdl" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PoiWSService">
<wsdl:port binding="impl:POISoapBinding" name="POI">
<wsdlsoap:address location="http://mylink.fr/wsdl"/>
</wsdl:port>
</wsdl:service>
我收到此错误:
SoapFault exception: [Server.userException] No such operation 'createPOI' in /var/www/devt/cronJobs/test.php:58
Stack trace: #0 /var/www/devt/cronJobs/test.php(58): SoapClient->__call('createPOI', Array)
#1 /var/www/devt/cronJobs/test.php(58): SoapClient->createPOI(Array)
#2 {main}
你能说我的问题在哪里并解释一下吗?
我是 SOAP 的初学者
提前致谢