Handling SOAP Faults
As
explained in Chapter 4, SOAP faults indicate
errors at the application level. For example, a request for a
nonexistent service or method name will trigger a fault. Service
objects can also trigger faults, providing a means of propagating
errors back to the client. Propagating exceptions and errors back to
the client is particularly critical for building robust applications.
For example, in the catalog applications we have created so far, we
have assumed that the user will always pass a valid, current SKU.
What happens when the user requests a SKU for a nonexistent product?
To explore this question, and thereby illustrate several
fault-handling options, let’s examine an updated
version of the ProductService
example.
Get Web Services Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.