generating ASP.NET SOAP faults
April 9, 2003
I have been hacking around today using ASP.NET to create a web service (basically updating an existing ASP HTTP GET based credit card processing service).
I have run into a number of problems:
- I can’t specify that parameters are optional.
- I can’t generate a SOAP Fault.
I don’t think there is a solution to the former but I have discovered my problem with the latter.
I now know that it is trivial to generate a SOAP Fault with .Net by throwing a SoapException.
I spent an hour trying to generate a SOAP Fault while using the GET request. During lunch I realized that I was not sending a SOAP request so I should not expect a SOAP response.
So, I needed a quick way to send a SOAP request and see the result.
curl works well for this task:
curl -d @- -H "Content-Type: text/xml; charset=utf-8" "SOAPAction: \"http://missouri.edu/iats/ecommerce/\"" http://dev_server.missouri.edu/application/service.asmx
Note: You will need to change the charset and SOAPAction.
This causes curl to read the SOAP request from stdin.
The result returned now contains a SOAP fault (caused by the thrown SoapException).
Entry Filed under: programming. .
2 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>





1.
Ramesh | November 20, 2003 at 3:26 pm
Hi,
I am looking for doing exactly like this. can you please share you code sample which will return the SOAPException. I just couldn’t get this to work.
Thanks in advance
2.
nathan jacobs | November 20, 2003 at 9:47 pm
My understanding is that any uncaught exception will be converted into a SOAPException by ASP.NET so long as it is processing a SOAP request.