再会,
我在 nusoap 中传递 xml 时遇到问题。
示例:我通过了这个 xml
<test>123</test>
nusoap 响应是
test123/test
大于和小于号被删除。
这是我的服务器代码:
require_once('nusoap/nusoap.php');
$server = new nusoap_server; // Create server instance
$server->configureWSDL('demows','http://example.org/demo');
$server->register('myFunction',
array("param"=>"xsd:string"), // input
array("result"=>"xsd:string"), // output
'http://example.org/demo'
);
function myFunction($parameters) {
return $parameters;
}
// Use the request to try to invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA: '';
$server->service($HTTP_RAW_POST_DATA);
这是我给客户的代码:
require_once('nusoap/nusoap.php');
$client = new nusoap_client('http://localhost/nusoap/ws.php?wsdl', true);
$clientparam = '<test>123</test>';
$result = $client->call('myFunction',
array('param'=>$clientparam)
);
print_r($result);
*请注意,上述代码适用于 PHP 5.3.0 版,但不适用于我们生产中使用的 PHP 5.2.0-8+etch13 版。
我已经在网上搜索了有关 2 版本的任何问题,但没有找到。非常感谢任何帮助。TIA