1
我已經使用PHP創建簡單的SOAP服務器,使用的WSDL是:http://fromyourdesign.com/webapp/wsdl/fromyourdesign.wsdlSOAP響應命名空間問題
響應即時得到具有對LoginResponse標籤不匹配的命名空間:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://roomplanner.icovia.com/pci">
<SOAP-ENV:Body>
<ns1:LoginResponse xsi:type="http://roomplanner.icovia.com/pci"> <<<==== This shoud be <LoginResponse xmlns="http://roomplanner.icovia.com/pci">
<LoginResult>
<register>
<customer>Rajat Teotia</customer>
</register>
</LoginResult>
</ns1:LoginResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
代碼很簡單肥皂服務器是:
<?php
class Login {
public function Login($username, $password) {
$ns = 'http://roomplanner.icovia.com/pci';
$LoginResponse = new StdClass();
$LoginResponse->LoginResult->register->customer = 'Rajat Teotia';
return new SoapVar ($LoginResponse, SOAP_ENC_OBJECT, $ns);
}
}
$fydWsdl = "http://www.fromyourdesign.com/webapp/wsdl/fromyourdesign.wsdl";
ini_set ("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$server = new SoapServer ($fydWsdl);
$server->setClass ("Login");
$server->handle();
?>
可以採取什麼措施來解決此問題。提前致謝。
Rajat
命名空間是第四個參數,而不是第三個參數 – Wrikken 2010-07-23 22:55:29