Reputation: 1266
I am using SoapException
to handle invalid inputs and all other kind of exception handling in my web service. It's working fine and I am able to format and return proper information to client. I am following a method similar to the one explained here
http://www.codinghorror.com/blog/2004/08/throwing-better-soap-exceptions.html
Now I want to change the response code it returns when a SoapException
happens (ResponseCode: 500 Internal Server Error).
Following is the default response code am getting in addition to my own custom XML
data when a SoapException
occurs. I want to change the ResponseCode
to 200.. Is it possible and how?
ResponseCode: 500 (Internal Server Error)
Connection:Close
Content-Length:494
Cache-Control:private
Content-Type:text/xml; charset=utf-8
Date:Tue, 25 Jan 2011 06:59:30 GMT
Server:ASP.NET Development Server/8.0.0.0
X-AspNet-Version:2.0.50727
Upvotes: 2
Views: 2595
Reputation: 1018
In support of John Sauders' word of warning above, according to WS-I Basic profile:
"R1126 An INSTANCE MUST use a "500 Internal Server Error" HTTP status code if the response message is a SOAP Fault."
http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#refinement16488480
Upvotes: 2