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:
Java and .NET both bring something to the party
by Paul Steinberg, Sharat Agarwal, and George Vorobiov. Intel Corp. ...
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...

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

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

Related Jobs:

Consultant #150479 - CA - San Francisco - Microsoft Corporation
MS Services Labs Job Title: Consultant Target Range: 60-64 Location...
Consultant #150540 - NC - Charlotte - Microsoft Corporation
MS Services Labs Job Title: Consultant Target Range: 60-64 Location...
Software Development Engineer #137909 - WA - Redmond - Microsoft Corporation
We are seeking creative, highly motivated software engineers, both for...
Software Development Engineer #137175 - WA - Redmond - Microsoft Corporation
How often do you help out relatives, friends, neighbors, and anyone el...
Software Development Engineer #136643 - WA - Redmond - Microsoft Corporation
Are you passionate about working on business applications built on the...
Super-Ntwk Test&Turn Up #06-3021 SD - PA - Philadelphia - SunGard
Reference No.: 06-3021 SD Opening Date: January 6, 2006 Job Title:...
Software Development Engineer #138276 - WA - Redmond - Microsoft Corporation
Do you want to leverage state-of-the-art technologies such as Visual S...
J2EE App developer #2354828 - TX - Houston - Ajilon
Description : If you're an IT professional looking for exciting, new...
Program Manager #145872 - WA - Redmond - Microsoft Corporation
Developer Division Setup team is looking for a senior PM who can provi...
Software Development Engineer #142863 - WA - Redmond - Microsoft Corporation
You use e-mail every single day. Did you ever have a crazy idea about ...