日安,
我很难在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);*请注意,上面的代码是在PHP5.3.0版本上工作的,而不是在PHPVersion5.2.0-8+etch13上工作,这是我们正在使用的版本。
我在网上搜索了2版的任何问题,但都没有找到。任何帮助都是非常感谢的。提亚
发布于 2010-12-05 22:00:15
升级libxml2并重新构建PHP。
发布于 2010-07-21 13:53:33
我一点也不知道nusoap,但听起来你的实体被抛弃了。可能值得对两端的实体进行控制,例如手动更改“for >,”<“<”,或者使用诸如htmlentities()之类的函数来控制这些实体。
发布于 2010-08-02 16:40:55
不确定您是否使用了与我不同的nusoap版本,但我一直在使用代理,它似乎正在工作。我还用soapclient而不是nusoap_client实例化客户机(以前没有见过):
$client = new soapclient('http://localhost/nusoap/ws.php?wsdl', true);
$proxy = $client->getProxy();
$response = $proxy->call("myfunction", array('test' => 123));https://stackoverflow.com/questions/3295836
复制相似问题