Witam, dostałem zadanie zrobienia integracji z api kuriera geis. Zacząłem od
$wsdl = 'https://gclient.etlogistik.com/GServiceTest/GService.svc?wsdl';
$client = new SoapClient ($wsdl, array('ssl_method'=> SOAP_SSL_METHOD_SSLv23, 'trace'=>true, 'exceptions'=>true, 'location' => 'https://gclient.etlogistik.com/GServiceTest/GService.svc?wsdl', 'soap_version' => 'SOAP_1_2 '));
echo '<pre>';
var_dump($client->__getFunctions());
echo '<br>';
var_dump($client->__getTypes());
echo '</pre>';
dostaję takie coś:
array(18) {
[0]=>
string(56) "ServiceListResponse ServiceList(ServiceList $parameters)"
[1]=>
string(65) "AddServiceListResponse AddServiceList(AddServiceList $parameters)"
[2]=>
...
}
array(151) {
[0]=>
string(8) "int char"
[1]=>
string(17) "duration duration"
[2]=>
string(11) "string guid"
[3]=>
string(40) "struct ArrayOfstring {
string string;
}"
[4]=>
string(96) "struct RequestOfServiceRequestHUsxwOXq {
RequestHeader Header;
ServiceRequest RequestObject;
}"
[5]=>
string(84) "struct RequestHeader {
string CustomerCode;
Language Language;
string Password;
}"
[6]=>
string(15) "string Language"
[7]=>
string(25) "struct ServiceRequest {
}"
[8]=>
string(196) "struct ResponseOfServiceRequestArrayOfServicepMtQ0fwN {
string ErrorCode;
string ErrorMessage;
RequestOfServiceRequestHUsxwOXq Request;
ArrayOfService ResponseObject;
ResponseStatus Status;
}"
[9]=>
string(43) "struct ArrayOfService {
Service Service;
}"
[10]=>
string(46) "struct Service {
string Code;
string Name;
}"
...
}
chcę skorzystać z funkcji ServiceList:
$serviceList = $client->ServiceList('ServiceList', array('CustomerCode' => 'xxx', 'Language' => 'PL', 'Password' => 'xxx'));
wygenerowane zapytanie
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:ServiceList/><param1><item><key>CustomerCode</key><value>xxx</value></item><item><key>Language</key><value>PL</value></item><item><key>Password</key><value>xxx</value></item></param1></SOAP-ENV:Body></SOAP-ENV:Envelope>
zapytanie zwraca wyjątek
The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'ServiceList'. End element 'Body' from namespace 'http://schemas.xmlsoap.org/soap/envelope/' expected. Found element 'param1' from namespace ''. Line 2, position 152.string(165) "
To moje pierwsze spotkanie z soap. Co robię źle? Będę wdzięczny za pomoc