I develop the system to export some data from the client’s side using the SOAP. I have a link to their staging wsdl, and implemented some kind of the SOAP client, but unfortunately my SOAP request is empty and the response is the error one.
Link to WSDL: https://rewardsservices.griris.net/mapi/OrderManagementServices.svc?wsdl
Operation called: exportPendingOrder
Snippet of my SOAP Client:
$soap = new SoapClient('https://rewardsservices.griris.net/mapi/OrderManagementServices.svc?wsdl', [ 'soap_version' => SOAP_1_2, 'cache_wsdl' => WSDL_CACHE_NONE, 'trace' => 1, 'exception' => 1, ]); $headers = [ new SoapHeader( 'http://www.w3.org/2005/08/addressing', 'Action', 'http://tempuri.org/IOrderManagementServices/exportPendingOrder', true ), new SoapHeader( 'http://www.w3.org/2005/08/addressing', 'To', 'https://rewardsservices.griris.net/mapi/OrderManagementServices.svc', true ), ]; $soap->__setSoapHeaders($headers); try { $params = [ 'parameters' => [ 'merchantNetworkID' => "XXX", 'merchantCode' => "XXX", 'subProgramNetworkID' => "XXX", 'countryISOCode' => "XXX", 'grToken' => "XXX", 'requestId' => (new DateTime())->getTimestamp(), ], ]; $result = $soap->exportPendingOrder($params); var_dump([ 'params' => $params, 'result' => $result, 'request' => $soap->__getLastRequest(), 'response' => $soap->__getLastResponse(), ]); } catch (SoapFault $exception) { var_dump([ 'error_message' => $exception->getMessage(), 'request' => $soap->__getLastRequest(), 'response' => $soap->__getLastResponse(), ]); }
Log information (incl. the request/response):
array(4) { ["params"]=> array(1) { ["parameters"]=> array(6) { ["merchantNetworkID"]=> string(36) "XXX" ["merchantCode"]=> string(3) "XXX" ["subProgramNetworkID"]=> string(36) "XXX" ["countryISOCode"]=> string(2) "XXX" ["grToken"]=> string(110) "XXX" ["requestId"]=> int(1619772724) } } ["result"]=> object(stdClass)#185 (1) { ["exportPendingOrderResult"]=> string(121) "{"responseCode":"1002","description":"Required field value missing","result":{"requestID":null,"serializedDataset":null}}" } ["request"]=> string(496) "<?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://tempuri.org/" xmlns:ns2="http://www.w3.org/2005/08/addressing"><env:Header><ns2:Action env:mustUnderstand="true">http://tempuri.org/IOrderManagementServices/exportPendingOrder</ns2:Action><ns2:To env:mustUnderstand="true">https://rewardsservices.griris.net/mapi/OrderManagementServices.svc</ns2:To></env:Header><env:Body><ns1:exportPendingOrder/></env:Body></env:Envelope> " ["response"]=> string(531) "<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/IOrderManagementServices/exportPendingOrderResponse</a:Action></s:Header><s:Body><exportPendingOrderResponse xmlns="http://tempuri.org/"><exportPendingOrderResult>{"responseCode":"1002","description":"Required field value missing","result":{"requestID":null,"serializedDataset":null}}</exportPendingOrderResult></exportPendingOrderResponse></s:Body></s:Envelope>" }
Could you please advise what I do wrongly, and why my SOAP request is empty basing on the wsdl provided? Any help is appreciated!
Thanks in advance,
Yevhen
Advertisement
Answer
Finally I have managed to send the non-empty request. I have checked the partner’s wsdl using the SoapUI tool and it showed me the correct format of the request. So the correct request has to be the following one:
... $params = [ 'JsonData' => json_encode([ 'merchantNetworkID' => "XXX", 'merchantCode' => "XXX", 'subProgramNetworkID' => "XXX", 'countryISOCode' => "XXX", 'grToken' => "XXX", 'requestId' => (new DateTime())->getTimestamp(), ]), ]; ...