Visual Studio: The annoyance of Web References

| | Comments (0) | TrackBacks (0)
Web References in Visual Studio are annoying. Yes, they take the pain out of binding to a web service, providing generated code that gives you type-safety. But, and this is a big but, the classes that Visual Studio generates are marked as public rather than internal. If you're writing a library that wraps your web service, this provides any caller of the library with direct access to the web service, not so bad I hear you say as anyone who knows the Url can add it as a Web Reference and code directly against it. The big annoyance is that it makes your libraries interface messy and exposes what's essentially an implementation detail. Imagine for a moment that you have an application where the layers are deployed to separate machines, and also geographically dispersed, using a model similar to the one below.
WebDiagram.png
In this model you'd want to hide the web service as it may not ever be used (and really is an implementation detail!), the lack of an option to define the visibility of the Web Reference makes this impossible without hand editing the generated code.

Related Links
- The bug/feature request logged on MS Connect site. (Marked Closed/WontFix, grr!)
- Programatically adding Web References, I've not looked in too much detail, but maybe it's possible to use this to add an internal web reference?

0 TrackBacks

Listed below are links to blogs that reference this entry: Visual Studio: The annoyance of Web References.

TrackBack URL for this entry: http://www.robertwray.co.uk/mt/mt-tb.cgi/127

Leave a comment

About this Entry

This page contains a single entry by Rob published on January 16, 2008 1:07 PM.

You have to Start to Shutdown? was the previous entry in this blog.

ASP.net: Viewstate is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.23-en