przykład pokazuje jak powinna wyglądać wysyłana treść
POST /WebAPI.asmx HTTP/1.1 Host: webapi.xxx.pl Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <doLogin xmlns="http://webapi.xxx.pl/"> <Token>string</Token> <EMail>string</EMail> <Passwd>string</Passwd> <RefreshPrice>boolean</RefreshPrice> </doLogin> </soap12:Body> </soap12:Envelope>
zrobiłem taki kod
'Token' => 'XXX-XXX', 'EMail' => 'XXX', 'Passwd' => 'XXX', ); $soap = new SoapClient('https://webapi.xxx.pl/WebAPI.asmx?WSDL', array('soap_version' => SOAP_1_2, 'trace' => 1)); $result = $soap->__soapCall('doLogin',$tab);
i oto wynik powyższego skryptu
stdClass Object ( [doLoginResult] => stdClass Object ( [ErrorMessage] => Procedure or function 'SDG_WebAPI_pDoLogin' expects parameter '@pToken', which was not supplied. [ErrorCode] => UnknowError [SessionKey] => ) ) POST /WebAPI.asmx HTTP/1.1 Host: webapi.xxx.pl Connection: Keep-Alive User-Agent: PHP-SOAP/5.3.28-0+tld2 Content-Type: application/soap+xml; charset=utf-8; action="http://webapi.xxx.pl/doLogin" Content-Length: 254 REQUEST: <?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://webapi.xxx.pl/"> <env:Body> <ns1:doLogin/> <param1>XXX</param1> <param2>XXX</param2> </env:Body> </env:Envelope> HTTP/1.1 200 OK Cache-Control: private, max-age=0 Content-Type: application/soap+xml; charset=utf-8 Server: Microsoft-IIS/7.0 X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET Date: Wed, 11 Jun 2014 09:28:50 GMT Content-Length: 521 Response: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <doLoginResponse xmlns="http://webapi.xxx.pl/"> <doLoginResult> <ErrorMessage>Procedure or function 'SDG_WebAPI_pDoLogin' expects parameter '@pToken', which was not supplied.</ErrorMessage> <ErrorCode>UnknowError</ErrorCode> <SessionKey /> </doLoginResult> </doLoginResponse> </soap:Body> </soap:Envelope>
wie ktoś dlaczego moja wysyłana paczka różni się od przykładu i co zmienić żeby wszystko było jak w przykładzie?