Enterprise solutions typically aggregate information from myriad internal applications and external sources. Web services have gained rapid adoption as a method to easily and reliably consume the varied data required by these solutions. Situations inevitably arise in which a single solution requires the consumption of multiple complementary Web services, which often share company-specific or domain-specific XML types. Unfortunately, the very tools that have helped to drive the growing adoption of Web services, and the enabling abstractions that they provide, can often prevent developers from peeking behind the curtains at the XML standards that make up the Web services stack. This article will offer a solution that enables type sharing between proxies created for complementary Web services, while at the same time providing an opportunity to examine the Web Services Description Language (WSDL) and its interaction with the Web services tools we know and love.
The first time I tried to create two complementary Web services that would share a common XML type, I ran into an unpleasant surprise. Each of the proxies that had been created in my client application had a separate object representation for the common message, in a separate C# namespace. I had to copy each of the properties manually from an instance of one class to an instance of the other, which seemed an unnecessary artifact of the current implementation of the tools.