Reusing Class Library between Web Service and consumer
Tweet.NET and Visual Studio make it Web Service consumers very easy to generate a proxy for accessing the Web Service. It uses the WSDL to generate all the methods, even the asynchronous access methods. Also all data-structures are generated. Sadly all lists are generated like simple array's.
Wouldn't it be nice to use the same data-structures on the consumer as we can on the Web Service? I've been thinking about this for a long time, but as far as I knew it wasn't possible. Also a lot of people told me it just wasn't possible.
I've been thinking about a solution to do some of the deserialization on the generated proxy myself. But in my trial to create a solution and searching the Internet for possible solutions I found out about a feature called Schema Importer Extension. This can be used during proxy generation by wsdl.exe or from within Visual Studio 2005 (and maybe 2008).
Some time ago Jelle Druyts wrote an article: Customizing generated Web Service proxies in Visual Studio 2005. In this article he explains how the Schema Importer Extension works. Besides this he also writes an Schema Importer Extension that can be configured for all the data-structures that need to be reused. It's a very nice solution, only it's sad that I need to configure it. While it would be nice if discovering was automatically. But in this case you can see there is a solution to the problem where data-structures are shared between Web Service and consumer by using a class library.
Windows Communication Foundation already supports some kind of reusing. When adding a Service Reference instead of a Web Reference you can choose to reuse existing classes. I tried to use this with a plain ASP.NET Web Service without luck.



