Sto comunicando con un servizio web in SOAP con php. Ecco il mio codice:PHP SoapClient malformato xml
$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);
Per qualche ragione, l'XML è sbagliato:
<?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> ...
Come mai il nome del nodo XML è paramX quando dovrebbe essere il nome della variabile? Che cosa sto facendo di sbagliato ??
Grazie
Aggiornamento: Così ho elencato le funzioni da quella webservice e quello che ottengo è:
Some_Service_Response Some_Service(Some_Service $parameters))
ho cambiato la mia chiamata in modo che è ora:
$SOAP->__call('Some_Service', array('Some_Service', $data));
E l'XML è ancora errato:
<?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> ....
ho ancora <param1><item><key>SomeKey</key><value>SomeValue</value> instead of <Somekey>SomeValue</Somekey>
Quindi la domanda è, è il servizio Web non funziona correttamente o è il mio fine?
È già il caso – Eric
@Eric Nella domanda '$ data' è un array, non un oggetto. –
Oh scusa, sì hai ragione :) – Eric