肥皂响应命名空间问题 [英] Soap Response Namespace issue
问题描述
我已经使用php创建了简单的肥皂服务器,使用的WSDL位于: http://fromyourdesign.com/webapp/wsdl/fromyourdesign.wsdl
I have created simple soap server using php, The WSDL used is at : http://fromyourdesign.com/webapp/wsdl/fromyourdesign.wsdl
我得到的响应的LoginResponse标记的名称空间不匹配:
Response i m getting has a mismatched namespace for the LoginResponse tag:
<?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>
简单的soap服务器的代码是:
Code for the simple soap server is :
<?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 ();
?>
如何解决此问题.预先感谢.
What can be done to fix this issue. Thanks in advance.
Rajat
推荐答案
似乎,您的代码中的参数列表不正确.命名空间应该是第四个参数,而不是第三个参数.
Seems, you have a wrong list of parameters in your code. Namespace should be the fourth parameter, not the third.
SoapVar :: SoapVar(字符串$ data,字符串$ encoding [,字符串$ type_name [,字符串$ type_namespace [,字符串$ node_name [,字符串$ node_namespace]]]]])
SoapVar::SoapVar ( string $data , string $encoding [, string $type_name [, string $type_namespace [, string $node_name [, string $node_namespace ]]]] )
问候 朱利安
这篇关于肥皂响应命名空间问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!