Php Soap响应命名空间问题
我使用php创建了简单的soap服务器,使用的WSDL位于: 我得到的响应具有与LoginResponse标记不匹配的命名空间:Php Soap响应命名空间问题,php,soap,namespaces,Php,Soap,Namespaces,我使用php创建了简单的soap服务器,使用的WSDL位于: 我得到的响应具有与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
<?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>
如何解决此问题。提前谢谢
Rajat看来,代码中的参数列表是错误的。命名空间应该是第四个参数,而不是第三个参数 SoapVar::SoapVar(字符串$data,字符串$encoding[,字符串$type_name[,字符串$type_namespace[,字符串$node_name[,字符串$node_namespace]])) 问候
Julian名称空间是第四个参数,而不是第三个参数
<?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 ();
?>