Re: exception responses to ASP.Net soap services





"Mark" <mmodrall@xxxxxxxxxxxxx> wrote in message news:FE334499-56F3-49B8-B8BD-C79434D4C155@xxxxxxxxxxxxxxxx
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

How are you invoking the service? From the browser? That isn't using SOAP!

--
John Saunders | MVP - Connected System Developer

.


Loading