IPN传送失败. HTTP错误代码405:不允许的方法 [英] IPN delivery failed. HTTP error code 405: Method Not Allowed

查看:159
本文介绍了IPN传送失败. HTTP错误代码405:不允许的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试测试我编写的用于处理Payapal IPN通知的servlet(我的servlet与以下

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.

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

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传递失败. HTTP错误代码405:不允许使用方法

有人有丝毫线索吗?

我也在寻求 ANY 的建议,以直接的方式测试IPN处理程序,因为IPN模拟器很烂(您选择的任何选项都会重置所有字段,依此类推).

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).

任何帮助表示赞赏!

推荐答案

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

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 '^]'.

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

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

如果您没有看到200状态,则表明您的应用程序未正确处理POST请求,这可能是405错误的原因.

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.

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

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

如果您能够从IPN模拟器获取请求的工作,并准备进行沙盒测试,请确保您具有正确的通知URL,并且在沙盒卖方的个人资料下启用了IPN.

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.

此外,请确保您的IPN处理程序也正在记录INVALID请求,以便您知道该请求是否已启动.

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

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

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)

这篇关于IPN传送失败. HTTP错误代码405:不允许的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆