Handle and raise exceptions from Web services
Easy SOAP Web Services: Since Web services provide a platform-independent way of leveraging a specific functionality, the exceptions that occur in Web services must also be communicated in a platform-independent manner. To accomplish this communication, it must be compliant with the SOAP specification.

by Thiru Thangarathinam, Intel Corp.

An exception is any error condition or unexpected behavior encountered by an executing program. Exceptions can occur for a number of reasons, such as faulty code, unavailable operating system resources, unexpected Common Language Runtime conditions, and so on. While your application can recover from some of these conditions, most runtime exceptions are irrecoverable. In that case, you need an effective way of handling the exception.

Web services are a relatively new form of distributed computing. In distributed computing, applications are designed as services that run on a server. Clients access these services through a programmable interface. When there is an exception during the execution of a Web service, the exception not only needs to be captured, but it also must be communicated back to the consumers of the Web service.

Since Web services provide a platform-independent of way of leveraging a specific functionality, the exceptions that occur in Web services must also be communicated in a platform-independent manner. To accomplish this communication, it must be compliant with the SOAP specification.

.NET Provides Robust Structured Exceptions Handling
The crux of the exception handling support in a .NET Web service is provided by the try Catch finally construction. The try keyword precedes a block of normal processing code that may throw an exception. The catch keyword precedes a block of exception-handling code. The finally keyword precedes a block of code that will always be executed after handling the exceptions. Once an exception is thrown from a try block, the program flow switches to the first catch block following it.

A well-designed set of error-handling code blocks can go a long way in making a program more robust and less prone to crashing. The best practices for handling exceptions can be summarized as follows:

Subscribers who liked this article also read:
Consolidating the IT infrastructure: leveraging Oracle9i Real Application Clusters on Intel to build an 'Adaptive Architecture'
Intel Corp., Oracle Corp., and Cap Gemini Ernst & Young. Cap Gemi...
Java and .NET both bring something to the party
by Paul Steinberg, Sharat Agarwal, and George Vorobiov. Intel Corp. ...

If you're interested in this topic, these articles may be helpful:

The path to successful Web services: navigating the pitfalls
by Jason Bloomberg, senior analyst, ZapThink LLC Abstract Web serv...
Adding Security to your Web Services Digital Signatures, Part 2
This demo shows how to expose a simple Java™ class as a Web serv...
Developing Web services with Java 2 Platform, Enterprise Edition 1.4
by Qusay H. Mahmoud, Sun Microsystems Inc. The Java 2 Platform,...
Web services: the powerful tenets of SOA
by Jason Bloomberg and Ron Schmelzer, senior analysts, ZapThink LLC ...
Consuming WebSphere Application Server Web services from Eclipse Rich Client Platform applications
This tutorial teaches you how to configure an Eclipse® Rich Client...

Related Jobs:

J2EE App developer #2354828 - TX - Houston - Ajilon
Description : If you're an IT professional looking for exciting, new...
Software Development Engineer #151253 - WA - Redmond - Microsoft Corporation
Dynamic languages like Python, Ruby, PHP, and JavaScript are becoming ...
Consultant #150540 - NC - Charlotte - Microsoft Corporation
MS Services Labs Job Title: Consultant Target Range: 60-64 Location...
Consultant #150539 - CA - San Diego - Microsoft Corporation
MS Services Labs Job Title: Consultant Target Range: 60-64 Location...
Super-Ntwk Test&Turn Up #06-3021 SD - PA - Philadelphia - SunGard
Reference No.: 06-3021 SD Opening Date: January 6, 2006 Job Title:...
Program Manager #151602 - WA - Redmond - Microsoft Corporation
Would you like to work on the very heart of managed code? Are you pass...
Senior .NET Developer #16348 - US - New York - Bloomberg L.P.
DESCRIPTION: The Microsoft Technology Research team is looking for e...
Software Development Engineer #137175 - WA - Redmond - Microsoft Corporation
How often do you help out relatives, friends, neighbors, and anyone el...
Software Development Engineer #149804 - WA - Redmond - Microsoft Corporation
Be a key contributor designing and implementing the Debugging Services...
Software Development Engineer #149753 - CA - Mountain View - Microsoft Corporation
We are seeking creative, highly motivated software engineers, both for...