eBay平台通知SOAP监听器问题


eBay Platform Notifications SOAP Listener Issue

我正在尝试使用官方的platformnotificationscodessample - php模板设置eBay平台通知。

我已经用我的密钥和令牌成功配置了ebay.ini。这样,SetNotificationPreferences.phpGetNotificationPreferences.php都可以成功调用,没有问题。

使用GetNotificationPreferences,我可以看到我成功地将ApplicationURL更改为http://localhost/notifications/listener.php

如果我尝试通过命令行访问generator.php,则返回一个成功的调用

C:'development'xampp'htdocs'notifications>php generator.php
  <?xml version="1.0" encoding="UTF-8"?>
  <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:ns1="urn:ebay:apis:eBLBaseComponents" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body><ns1:GetMemberMessagesResponseResponse><return xsi:type="xsd:string">
  trachtenberga</return></ns1:GetMemberMessagesResponseResponse>
  </SOAP-ENV:Body></SOAP-ENV:Envelope>

来自$argc $notifications arrayAskSellerQuestion.xml

我只是真的很困惑,listener.php是如何工作的。

无论我是直接在浏览器(http://localhost/notifications/listener.php)中访问它,还是在命令行中访问它,我总是得到以下错误消息:

Notice: Undefined index: HTTP_RAW_POST_DATA in C:'development'xampp'htdocs'notifications'listener.php on line 107

这一行是:

$stdin = $GLOBALS['HTTP_RAW_POST_DATA'];

迄今为止,我发现Undefined index: HTTP_RAW_POST_DATA问题的唯一可能的解决方案是将我的php.ini配置更改为always_populate_raw_post_data = On,但这没有影响,我仍然得到相同的错误。

我知道它被建议使用php://input代替,因为$HTTP_RAW_POST_DATA在PHP 5.6.0中折旧,并在PHP 7.0.0中删除,但根据eBay知识库

请使用$GLOBALS["HTTP_RAW_POST_DATA"]来捕获负载而不是file_get_contents(php://input)。我们有这样的问题客户端在捕获时检索截止的和不完整的有效负载PHP输入流

我如何让这个SOAP侦听器工作,以便我可以开始配置我的平台通知?

忘记这个线程。我的解决方案是简单地使用

if (!isset($HTTP_RAW_POST_DATA)) {
$HTTP_RAW_POST_DATA = file_get_contents("php://input");
}
// then do what you want, for example I was doing something like this
// to save the xml response to my web server
$file_name= "order_shipped_".time().".xml";
$stdin = $GLOBALS['HTTP_RAW_POST_DATA'];
file_put_contents($file_name, $stdin);

我一直收到我所有的通知。

但是根据原始的线程,我不确定这是考虑到eBay知识库和功能折旧的最佳解决方案。如果有人对此有更多的意见,请随时发表意见:)