我正在使用PHP与SOAP中的web服务进行通信.这是我的代码:
$data = array('name' => 'test','age' => 20); $WDSL = 'http://xxx.xxxxx.xxx/wdsl.ibs?wsdl'; $SOAP = new SoapClient($WDSL,array('trace' => true)); $RESULT = $SOAP->__soapCall('Some_Service',$data);
出于某种原因,XML是错误的:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Some_Crap"><SOAP-ENV:Body><ns1:Some_Service/><param1>test</param1><param2>20</param2> ...
当XML节点名称应该是变量名时,它是如何变换的?我究竟做错了什么 ??
谢谢
更新:
所以我列出了该Web服务的功能,我得到的是:
Some_Service_Response Some_Service(Some_Service $parameters))
我改变了我的电话,现在是:
$SOAP->__call('Some_Service',array('Some_Service',$data));
XML仍然是错误的:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:iwaysoftware:ibse:jul2003:HR_Master"><SOAP-ENV:Body><ns1:Some_Service/> <param1><item><key>SomeKey</key><value>SomeValue</value> ....
我仍然得到< param1>< item>< key> SomeKey< / key>< value> SomeValue< / value>代替
< Somekey> someValue中< / Somekey>
所以问题是,Web服务不能正常运行还是我的结束?
如果我是你,我会尝试以对象格式设置$data.
原文链接:https://www.f2er.com/php/131681.html$data = array('name' => 'test','age' => 20);
例如:
$data = null; $data->name = "test"; $data->age = 20; $RESULT = $SOAP->__soapCall('Some_Service',$data);