我正在使用 SOAP 与 php 中的 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 节点名称为何是 paramX,而它应该是变量名称?我究竟做错了什么 ??
Thanks
更新 :
所以我列出了该网络服务的功能,我得到的是:
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> instead of
<Somekey>SomeValue</Somekey>
那么问题是,是 Web 服务无法正常工作还是我这边的问题?