I’m communicating with a webservice in SOAP with php. Here’s my code :
$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);
For some reason, the XML is wrong :
<?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> ...
How come the XML node name is paramX when it should be the variable name ? What am i doing wrong ??
Thanks
Update :
So I’ve listed the functions from that webservice and what I get is :
Some_Service_Response Some_Service(Some_Service $parameters))
I changed my call so it is now :
$SOAP->__call('Some_Service', array('Some_Service', $data));
And the XML is still wrong :
<?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> ....
I still get <param1><item><key>SomeKey</key><value>SomeValue</value> instead of
<Somekey>SomeValue</Somekey>
So the question is, is the Web Service not working properly or is it on my end ?
If I were you I’d try setting up $data in an object format.
For example: