Skip to Content
Programming WCF Services, 2nd Edition
book

Programming WCF Services, 2nd Edition

by Juval Lowy
November 2008
Intermediate to advanced
784 pages
23h 28m
English
O'Reilly Media, Inc.
Content preview from Programming WCF Services, 2nd Edition

Fault Propagation

While the default error-masking policy of WCF is a best practice, there are times when you are refrained from relying on it. This is typically the case when there is an existing application (or communication pattern) in place, and the service is required to throw particular exceptions as it processes inputs, reaches certain states, or encounters errors. The client is required to respond to these exceptions in a prescribed way. Obviously, controlling the flow of the application using expectations is hardly a good idea, as it leads to nonstructured programming and couples the client to the service. And yet, the underlying requirements remain: the service is required to report specific errors to the client, and the default masking of the errors by WCF precludes that. Another fundamental problem pertaining to propagating the error to the client is that exceptions are technology-specific, and as such should not be shared across the service boundary. For seamless interoperability, you need a way to map technology-specific exceptions to some neutral error information. This representation is called a SOAP fault. SOAP faults are based on an industry standard that is independent of any technology-specific exceptions, such as CLR, Java, or C++ exceptions. To return a SOAP fault (or just a fault, for short), the service cannot throw a raw CLR exception. Instead, the service must throw an instance of the FaultException<T> class, defined in Example 6-1.

Example 6-1. The FaultException<T> ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Programming WCF Services

Programming WCF Services

Juval Lowy
Programming WCF Services, 4th Edition

Programming WCF Services, 4th Edition

Juval Lowy, Michael Montgomery

Publisher Resources

ISBN: 9780596157210Errata