Article: Customizing generated Web Service proxies in Visual Studio 2005#

I'm proud and honored to see that my first article has been published on the Microsoft Belux website:

Customizing generated Web Service proxies in Visual Studio 2005

As the title implies, it talks about how you can customize the Web Service proxies that are generated by the "Add Web Reference" dialog box in Visual Studio 2005 or the WSDL.exe tool through a new mechanism introduced in .NET 2.0 called "Schema Importer Extensions".

Don't hesitate to let me know if you liked or disliked the article or the proposed solution!

Articles | Blog | Programming | .NET | VS.NET | Whidbey
Tuesday, December 27, 2005 12:02:45 PM (Romance Standard Time, UTC+01:00)
Great article, I'm investigating how to customize the output of xsd.exe (which also supports Schema Importer Extensions), currently items in the schema that have a 1 to many relation get generated as arrays. I would like to make use of System.Collections.Generic namespace and substiture these arrays for generic collections, say for example a List of T 'Customer'. I've been checking out alternatives to xsd.exe and even some tools that grab the output from xsd.exe and manipulate it. Then I discovered your article and Schema Importer Extensions…. I'm not fully sure I can do it with Schema Importer Extensions but It appears that I could. Again thanks for your work, it's a great overview of this technology, there’s not much out there at the moment…
Tuesday, January 03, 2006 10:22:52 PM (Romance Standard Time, UTC+01:00)
Good article, thank you,

But there is an other way for generating the proxy, take a look at the console application in the microsoft sample :

http://winfx.msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_fxsamples/html/3f5eb78f-0ef6-433a-b095-3a63b1ce0bc9.asp

It's for WinFx, but it work fine in .Net 2.0

No need to change machine.config or devenv.exe.config and no need to put the assembly in the GAC or in the Private assemblies directory

David
Wednesday, February 08, 2006 6:05:27 PM (Romance Standard Time, UTC+01:00)
There is also a free product named xwsdl.exe to generate the proxy without the business object.

http://devolutions.net/products/xwsdl.aspx

thank you
Wednesday, May 02, 2007 11:00:36 PM (Romance Standard Time, UTC+01:00)
Excellent article! I have not seen Schema Importer Extensions explained so well before.

As far as configuration goes, though, it would be really nice if there were some way to configure it more locally. I'm sure you've thought about this, but is there any sort of context available to the extension that would allow it to look for a configuration file that is local to, for example, the VS project in which the web reference is being generated?
Tuesday, May 08, 2007 8:39:41 PM (Romance Standard Time, UTC+01:00)
Hi Bill,

Thanks for the feedback! I can definitely see the need for a "project-local" configuration, and I think I even considered building that but I'm not sure if it was impossible or if I just chose another approach altogether.

I think the only tricky part is finding the project context somewhere in the schema importer extension, meaning that your extension doesn't typically have access to the Visual Studio project it's being called from (since they can also be called from outside Visual Studio). I'm not sure but it might be possible to find out about the project location or other context information through one of the many parameters in the ImportSchemaType or equivalent methods.

Hope that helps,

Jelle
Wednesday, June 06, 2007 5:46:27 PM (Romance Standard Time, UTC+01:00)
Great article, thanks. Do you know if there is a way to customize the actual web service proxy object, the SoapHttpClientProtocol implementation, and make the generated service class derive from a custom class (that would be an implementation of SoapHttpClientProtocol, of course)? We have a custom authentication method that consists of adding an additional soap header, and it would be great if we could override the invoke() method to do the adding of the soap header in our custom base class, and then make the code generator just extend our class instead of the SoapHttpClientProtocol class.

Thanks again.

Kendal.
Thursday, June 07, 2007 9:56:25 AM (Romance Standard Time, UTC+01:00)
You forgot the comma between the class name and assembly name, in the sample code, under the Deploying the Schema Importer Extension section.

>...we simply add the following lines to the <configuration> section of the machine.config file:

...
type="JelleDruyts.SchemaImporterExtensions.CustomerSchemaImporterExtension
JelleDruyts.SchemaImporterExtensions, Version=1.0.0.0,
Culture=neutral,
PublicKeyToken=c88d0fcd698a2de7" />

I copy-and-paste the code into my app.config. Tooks me a few hours to figure why I couldn't break-point into my custom schema importer extension.

It is an excellent article nonetheless.

Thanks,
An
Monday, June 11, 2007 7:41:07 PM (Romance Standard Time, UTC+01:00)
Kendal-

Unfortunately, no: it's not possible to change the actual web proxy class (or base class) using a Schema Importer Extension.

An-

Good catch! It must have slipped my watching eye :-(
Comments are closed.
All content © 2008, Jelle Druyts
On this page

Recent Photos
www.flickr.com
This is a Flickr badge showing public photos from Jelle Druyts. Make your own badge here.
Advertising
Top Picks
Statistics
Total Posts: 345
This Year: 8
This Month: 0
This Week: 0
Comments: 523
Archives
Sitemap
Disclaimer
This is my personal website, not my boss', not my mother's, and certainly not the pope's. My personal opinions may be irrelevant, inaccurate, boring or even plain wrong, I'm sorry if that makes you feel uncomfortable. But then again, you don't have to read them, I just hope you'll find something interesting here now and then. I'll certainly do my best. But if you don't like it, go read the pope's blog. I'm sure it's fascinating.

Powered by:
newtelligence dasBlog 2.0.7226.0

Sign In