I communicate with webservice in SOAP with php. Here is 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 incorrect:
<?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 did the XML name paramX come about when it should be the name of the variable? What am I doing wrong?
thanks
Update: Therefore, I have listed the functions from this web service, and I get:
Some_Service_Response Some_Service(Some_Service $parameters))
I changed my call so that it 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 at my end?