Developers Program

Troubleshooting the PHP 5 Platform Notification Sample Code

Published: April 13 2008, 11:55:00 PM·Updated: August 05 2022, 11:22:31 AM

Products

Question

Details on how to troubleshoot the PHP 5 notification sample code.

Answer

To verify that you're subscribed to the proper events, it's best to look at your NotificationPreferences on a user-level basis, so change this line in GetNotificationPreferences.php :
$params = array('Version' => 1193, 'PreferenceLevel' => 'User');
to add the PreferenceLevel of User


Then you should get something like this :

stdClass Object (
[Timestamp] => 2022-08-05T18:08:15.396Z
[Ack] => Success
[Version] => 1193
[UserDeliveryPreferenceArray] => stdClass Object (
[NotificationEnable] => Array (
[0] => stdClass Object (
[EventType] => EndOfAuction
[EventEnable] => Enable )
[1] => stdClass Object (
[EventType] => ItemRevised <<---- Subscribe to ItemRevised
[EventEnable] => Enable )
[2] => stdClass Object (
[EventType] => CustomCode
[EventEnable] => Enable ) ) ) )


You may not be able to use the debugging "error_log()" messages in the original sample code because you may not have access to your server error log. To get debugging information in this case, where needed, change the error_log statements to log to an accessible file rather than the Apache error log :

error_log("This writes to a file", 3, "/var/tmp/my-errors.log");


Also, in eBaySOAP.php, class eBayPlatformNotifications, set debug to be true by default, at least for now :
public function __construct(eBaySession $session, $debug = true) {


For example, to the ItemRevised event. You then will get output like this in your error log :

[Tue Aug 05 18:04:15 2022] [error] eBayPlatformNotificationListener: ItemRevised - ItemID : 110030062203

[Tue Aug 05 18:04:15 2022] [error]

<?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>
<ebl:RequesterCredentials soapenv:mustUnderstand="0" xmlns:ns="urn:ebay:apis:eBLBaseComponents" xmlns:ebl="urn:ebay:apis:eBLBaseComponents">
<ebl:NotificationSignature xmlns:ebl="urn:ebay:apis:eBLBaseComponents">2LoZdKnWgizobDsrTo9Ujw==</ebl:NotificationSignature>
</ebl:RequesterCredentials>
</soapenv:Header>
<soapenv:Body>
<GetItemResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2022-08-05T18:04:15.396Z</Timestamp>
<Ack>Success</Ack>
<CorrelationID>2818114854590</CorrelationID>
<Version>1193</Version>
<Build>E1193_CORE_API_19146280_R1</Build>
<NotificationEventName>ItemRevised</NotificationEventName>
<RecipientUserID>my_seller_store</RecipientUserID>
<Item>
<AutoPay>true</AutoPay>
<BuyerProtection>ItemIneligible</BuyerProtection>
<BuyItNowPrice currencyID="USD">0.0</BuyItNowPrice>
<Country>US</Country>
<Currency>USD</Currency>
….

<PictureDetails>
<GalleryType>Gallery</GalleryType>
<PhotoDisplay>PicturePack</PhotoDisplay>
<PictureURL>http://thumbs.qa.ebaystatic.com/pict/41007087008080_0.jp</PictureURL>

</PictureDetails>
<ProxyItem>false</ProxyItem>
</Item>
</GetItemResponse>
</soapenv:Body></soapenv:Envelope>



[Tue Aug 05 18:04:15 2022] [error] eBayPlatformNotificationListener: ItemRevised - ItemID : 110030062203


Note the first line comes from the "carp" method (modified to add a little more info). The next entry is the actual SOAP body for a GetItem coming back. This will have to be parsed to get the specific information you're looking for. Finally comes a line with more output from the "carp" method.

So recommendations for troubleshooting the PHP 5 sample notification code are :

  • Modify GetNotificationPreferences.php so you can get user-level information on the events you're subscribed to. Send this to me as needed.
  • Modify the error_log messages so you send output to an accessible file
  • Modify the carp and other debug methods so you can better see what's going on.
  • You may want to use the API Test Tool to send in raw XML requests like Set/GetNotificationPreferences
How well did this answer your question?