开发者

Is there a way to retrieve the message body when the server returns a 500 internal Server Error?

I have a routine that submits a 开发者_StackOverflow社区SOAP request using HttpWebRequest and WebResponse. If the SOAP Request fails the server sends back HTTP/1.1 500 Internal Server Error. When I trap the error I have yet to find a way to view the body of the reply which contains the fault code.

Is there a way to retrieve the message body when the server returns a 500 internal Server Error?

In body of the reply which I am not able to retrieve.

faultstring xml:lang="en-US" Specified argument was out of the range of valid values.


I haven't time to test this, but a WebException will be thrown in this situation.

You can get access to the error response via the WebException.Response property.

You will then be able to access information from the respons, e.g. you could try calling WebException.Response.GetResponseStream() to get the body of the response.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜