Web services are first and foremost about messages. No matter what platform you are using, what industry you are building services for, or what levels of complexity are available in your Web services stack, it all comes back to messages. When you are developing services or their corresponding clients, you are creating, transporting, and processing XML messages.
No matter how good your Web services tools are, there will inevitably be those moments when something doesn't work, and you find yourself brought back down to earth and staring at the content of your messages. The more sophisticated the service, the more complex the messages, and the more likely that you will find yourself in this situation. It is at that moment that you want more from your tools than just a good way of tracing messages. Developers building sophisticated Web services will inevitably need to take control over the content and structure of their messages.
The Microsoft .NET Framework has always provided good support for XML, the serialization of objects as XML, and support for Web services in general. For support of the latest Web services specifications, like WS-Addressing or WS-Security, however, developers must use the Web Services Enhancements (WSE) for .NET. The latest version of WSE (WSE 2.0) provides its own mechanism for custom message handling, in addition to supporting the hooks already in place in .NET. This article will discuss each of the methods available to developers for custom message serialization and will cover in detail the method used in WSE 2.0.
WSE 2.0 makes it possible for developers to build Web services and related client applications that possess, as the name suggests, enhanced features that the rest of the current .NET Web services infrastructure does not provide. For example, WSE provides message-level security through an implementation of the WS-Security specification, message routing through WS-Addressing, and service policy control through WS-Policy. While WSE gives developers the ability to use all of these enhanced features, at its core WSE 2.0 uses a simple messaging model that does not change, regardless of how many enhancements you take advantage of.