Re: exception responses to ASP.Net soap services
- From: Mark <mmodrall@xxxxxxxxxxxxx>
- Date: Fri, 3 Oct 2008 09:30:01 -0700
The simple Hello World example
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
namespace WebService1
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
throw new SoapException("boo hoo", SoapException.ServerFaultCode,
"http://tempuri.org/HelloWorld", new ApplicationException("Ha ha"));
return "Hello World";
}
}
}
produces :
HTTP/1.1 500 Internal Server Error
Server: ASP.NET Development Server/8.0.0.0
Date: Fri, 03 Oct 2008 16:25:39 GMT
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/plain; charset=utf-8
Content-Length: 250
Connection: Close
System.Web.Services.Protocols.SoapException: boo hoo --->
System.ApplicationException: Ha ha
--- End of inner exception stack trace ---
at WebService1.Service1.HelloWorld() in
C:\test\ConsoleApplication1\WebService1\Service1.asmx.cs:line 21
For example...
Thanks
Mark
"John Saunders" wrote:
"Mark" <mmodrall@xxxxxxxxxxxxx> wrote in message.
news:982724F7-C98F-46E5-9963-FF7728907745@xxxxxxxxxxxxxxxx
Hi...
How does one get an exception in a SOAP method call to get returned as a
SOAP error packet? I found several articles online that seemed to imply
wrapping it in a SoapException should result in proper handling but that
doesn't appear to be the case.
Throwing a SoapException from a web service method just leads to an http
status of 500 and no output at all.
Is there support in the framework for returning a soap exception packet,
or
does one have to roll one's own?
Any uncaught exception is translated into a SOAP Fault. That should always
happen.
Please create and post a small piece of code that reproduces the situation
where an exception is not returned as a SOAP Fault?
--
John Saunders | MVP - Connected System Developer
- Follow-Ups:
- Re: exception responses to ASP.Net soap services
- From: John Saunders
- Re: exception responses to ASP.Net soap services
- References:
- exception responses to ASP.Net soap services
- From: Mark
- Re: exception responses to ASP.Net soap services
- From: John Saunders
- exception responses to ASP.Net soap services
- Prev by Date: Re: Can I manipulate the width/Height of scroll bar on asp Panel webcontol?
- Next by Date: Re: exception responses to ASP.Net soap services
- Previous by thread: Re: exception responses to ASP.Net soap services
- Next by thread: Re: exception responses to ASP.Net soap services
- Index(es):
Relevant Pages
|
Loading