POST 在 HTTP 上工作正常,当使用 HTTPS 时,我收到 HTTP/1.1 405 Method Not Allowed

发布于 2024-12-08 10:00:37 字数 675 浏览 1 评论 0原文

我为 WCF SOAP Web 服务制作了一个 Android 客户端。 Web 服务托管在 IIS 服务器上。我可以使用 ksoap2-android 通过 HTTP 进行调用,没有任何问题,但是当我尝试使用 HTTPS 以更安全的方式执行调用,这是行不通的。我从服务器得到的响应是HTTP/1.1 405 Method Not Allowed。标头属性之一是 allow=[GET, HEAD, OPTIONS, TRACE],所以我猜问题是由于某种原因不允许 POST

我尝试使用 GET 来执行调用,但这似乎也不起作用。这真的很奇怪,但是当我查看连接时,它说方法是GET,但是当我查看连接的错误流时,它说方法是POST< /代码>。

请注意,我可以毫无问题地连接到浏览器中的 Web 服务,并且服务证书是正确的可信证书。我无法在 WCF 测试客户端中测试该服务,因此我不确定问题是否出在我的客户端、服务器或服务中。

我不太确定从这里该去哪里。我不太确定不允许 POST 是这里的真正问题。在我看来,似乎还有什么地方不对劲,但我不知道那会是什么。

I've made an Android client for a WCF SOAP web service. The web service is hosted on an IIS server. I can make calls using ksoap2-android over HTTP without problems, but when I tried to perform the calls in a more secure fashion using HTTPS, it doesn't work. The response I get from the server is HTTP/1.1 405 Method Not Allowed. One of the header properties is allow=[GET, HEAD, OPTIONS, TRACE], so I guess the problem is that POST isn't allowed for some reason.

I've tried to perform the call using GET instead, but that doesn't seem to work either. This is really weird, but when I look at the connection it says that the method is GET, but when I look at the error stream of the connection, it says that the method is POST.

Note that I can connect to the web service in the browser without problems and that the services certificate is a proper trusted one. I haven't been able to test the service in WCF Test Client, so I'm not sure if the problem is in my client or the server or service.

I'm not really sure where to go from here. I'm not really sure that POST not being allowed is the real problem here. It seems to me that there's something else that's wrong, but I have no idea what that would be.

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

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

发布评论

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

评论(2

忆梦 2024-12-15 10:00:37

我相信您的问题出在 ksoap2 androd 库的版本中

相关 SO 问题

所以你的问题可能是以下之一:

I believe your problem is in version of ksoap2 androd library

Related SO questions

So your problem can be one of these:

  • Old ksoap2 library (older than 2.5.2)
  • Untrusted SSL certifikate on server (answer how to fix it is here: KSOAP 2 Android with HTTPS)
一紙繁鸢 2024-12-15 10:00:37

我发现问题是我调用了目录(默认文档?)而不是 .svc 文件。当我完成地址和 .svc 文件的路径时,我成功解决了这个问题。现在我得到了 404 Not Found,但这是另一个问题。

基本上,当我确实应该调用 http://mydomain.com/service/service.svc 时,我调用了 http://mydomain.com/service/

I found out that the problem is that I made the call to the directory (default document?) and not the .svc file. When I completed the address with the path to the .svc file I managed to resolve this issue. Now I get 404 Not Found instead, but that's another question.

Basically, I called http://mydomain.com/service/ when I really should have called http://mydomain.com/service/service.svc.

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