skip to Main Content

When using the ebay API, it make notification requests to your server which can look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Header>
    Stuff in header
 </soapenv:Header>
 <soapenv:Body>
  <GetItemResponse xmlns="urn:ebay:apis:eBLBaseComponents">
   <Timestamp>2015-02-22T16:19:51.956Z</Timestamp>
   <Ack>Success</Ack>
   <CorrelationID>3759873</CorrelationID>
   <Version>885</Version>
   <Build>E885_CORE_APIMSG_16971418_R1</Build>
   <NotificationEventName>ItemRevised</NotificationEventName>
   .
   .
  </GetItemResponse>
 </soapenv:Body>
</soapenv:Envelope>

I define a function GetItemResponse then register it with the SOAP server object $server->addFunction("GetItemResponse");. The problem is that the function only gets passed the first element ” as the first argument. How do I get the full body passed to my function?

2

Answers


  1. Try converting the result to XML object like below:

    $xml = simplexml_load_string($response);
    

    and pass $xml

    Login or Signup to reply.
  2. Try this:

    function GetItem($arg1, $arg2, $arg3){
        var_dump(func_get_args());
    }
    $soapServer->addFunction('GetItem')
    

    GetItemResponse is node name that holds a response to GetItem call. Also you should add more parameters to GetItem function if you need them.

    More information about parameters: http://developer.ebay.com/DevZone/XML/docs/Reference/ebay/GetItem.html

    If you really need full body then override handle method from SoapServer. It will allow you to get whole body.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search