IPN 传送失败。 HTTP 错误代码 405:不允许的方法

发布于 2024-07-28 22:58:07 字数 478 浏览 2 评论 0原文

我正在尝试测试我编写的处理 payapal IPN 通知的 servlet(我的 servlet 与此非常相似 示例) - 即使在我使用的测试帐户中启用所有设置后,IPN 通知也根本不会触发。

然后我发现显然在沙箱中测试 IPN 的唯一方法是通过 IPN 模拟器。 我正在尝试使用它,但收到:

IPN 传送失败。 HTTP 错误代码 405:方法不允许

有人知道吗?

另外,我正在寻求任何建议,以便以简单的方式测试 IPN 处理程序,因为 IPN 模拟器有点糟糕(您选择的任何选项都会重置所有字段等)。

任何帮助表示赞赏!

I am trying to test a servlet I wrote that processes a payapal IPN notification (my servlet is very similar to this example) - thing is even after enabling all the settings in the test account I am using the IPN notification is not firing at all.

I then found out that apparently in the sandbox the only way to test IPN is through the IPN simulator. I am trying to use it but I am getting:

IPN delivery failed. HTTP error code 405: Method Not Allowed

Does anyone have the slightest clue?

Also I am seeking ANY advice for testing IPN handlers in a straightforward manner since the IPN simulator kind of sucks (any option you pick it resets all the fields and so forth).

Any help appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╰つ倒转 2024-08-04 22:58:07

我会检查以确保您的 Web 服务器允许对您的 IPN 处理程序 URL 发送 POST 请求。 在此示例中,我在您链接的页面上使用了示例的 PHP 版本,并将脚本放置在 /ipn.php 中。

然后我远程登录到我的服务器。 (替换为您的服务器地址)

$ telnet myserver.com 80
正在尝试 myserver.com... 
  连接到 myserver.com。 
  转义字符是“^]”。 
  

将以下内容粘贴到您的 telnet 会话中。 (替换 ipn.php 和 myserver.com)。 在最后一个命令后添加一个空行。

POST /ipn.php HTTP/1.1
Host: myserver.com
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 0

<前><代码>HTTP/1.1 200 好的

如果您没有看到 200 状态,则意味着您的应用程序未正确处理 POST 请求,这可能是导致 405 错误的原因。

您应该确保在 servlet 中实现 doPost() 方法以及 doGet()。

如果您能够从 IPN 模拟器获取请求,并准备好继续进行沙箱测试,请确保您拥有正确的通知 URL,并且在沙箱卖家的个人资料下启用了 IPN。

另外,请确保您的 IPN 处理程序也记录无效请求,以便您知道该请求是否已启动。

最后,确保在 servlet 中将 IPN 验证 URL 设置为 https://www.sandbox.paypal.com/cgi-bin/webscr。 (您发布的示例中的 URL 为 https://www.paypal.com/cgi-bin/webscr

I would check to make sure that your web server is allowing POST requests on your IPN handler URL. In this example, I used the PHP version of the example on the page you linked, and placed the script at /ipn.php.

I then telnet to my server. (replace with your server address)

$ telnet myserver.com 80
Trying myserver.com...
Connected to myserver.com.
Escape character is '^]'.

Paste the following into your telnet session. (replace ipn.php and myserver.com). Add a blank line after the last command.

POST /ipn.php HTTP/1.1
Host: myserver.com
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
HTTP/1.1 200 OK

If you don't see a 200 Status, it means your application is not handling POST requests properly, which is a probable cause of the 405 Error.

You should make sure that you implement a doPost() method in your servlet, as well as a doGet().

If you are able to get the requests working from the IPN simulator, and are ready to move on to sandbox testing, make sure that you have the correct Notify URL and that IPN is enabled under the sandbox seller's profile.

Also, make sure that you IPN Handler is logging INVALID requests as well, so that you know if the request was even initiated.

Finally, make sure that the IPN verification URL is set to https://www.sandbox.paypal.com/cgi-bin/webscr in your servlet. (the URL in the example you posted is https://www.paypal.com/cgi-bin/webscr)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文