O'Reilly logo

Real World XML Web Services: For VB and VB .NET Developers by Yasser Shohoud

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.6. Communicating Errors

SOAP provides a standard mechanism for reporting error information using the <soap:Fault> element as discussed in Chapter 3. When using .NET, any exceptions not caught in the Web method get reported to the client as a <soap:Fault>. Similarly, .NET clients throw a SoapException whenever they receive a <soap:Fault>. In the simplest case, you can communicate errors from a service by throwing an exception, for example:

Throw New Exception("This is the error information")

For more sophisticated scenarios, you can send structured error information as XML elements inside <soap:Fault>. To do this, you create a new SoapException and pass it an array of XML elements that you want to send to the client. SoapException has six ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required