我在从http请求获取和请求XML数据时遇到问题

时间:2022-04-11 01:45:38

I have 2 questions on this

我有2个问题

  • My code always seems to hit a 401 forbidden error when I try to post data to a http link
  • 当我尝试将数据发布到http链接时,我的代码似乎总是遇到401禁止错误

  • What is the best way to pull back and display xml data from the stream that I should be getting back?
  • 什么是从我应该回来的流中回退并显示xml数据的最佳方法?

1 个解决方案

#1


My guess regarding your first question: Your "401 Forbidden" is actually a "401 Unauthorized" ("Forbidden" would be a fatal error, and it has code 403). This 401 response is a normal part of the NTLM (Windows-integrated) challenge/response authentication mechanism. Your request must have correct credentials attached so it can authorize itself, then this error will go away.

我对你的第一个问题的猜测:你的“401 Forbidden”实际上是“401 Unauthorized”(“Forbidden”将是一个致命的错误,它有代码403)。此401响应是NTLM(Windows集成)质询/响应身份验证机制的正常部分。您的请求必须附加正确的凭据,以便它可以自行授权,然后此错误将消失。

Regarding your second question — It depends. What XML do you get back? Will displaying the raw XML string be useful?

关于你的第二个问题 - 这取决于。你得到什么XML?显示原始XML字符串是否有用?

#1


My guess regarding your first question: Your "401 Forbidden" is actually a "401 Unauthorized" ("Forbidden" would be a fatal error, and it has code 403). This 401 response is a normal part of the NTLM (Windows-integrated) challenge/response authentication mechanism. Your request must have correct credentials attached so it can authorize itself, then this error will go away.

我对你的第一个问题的猜测:你的“401 Forbidden”实际上是“401 Unauthorized”(“Forbidden”将是一个致命的错误,它有代码403)。此401响应是NTLM(Windows集成)质询/响应身份验证机制的正常部分。您的请求必须附加正确的凭据,以便它可以自行授权,然后此错误将消失。

Regarding your second question — It depends. What XML do you get back? Will displaying the raw XML string be useful?

关于你的第二个问题 - 这取决于。你得到什么XML?显示原始XML字符串是否有用?