472,960 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,960 software developers and data experts.

Versioning Web Services in ASP.NET 2.0

There is some debate on what an ideal web service interface would look like
at my organization. The debate revolves around how to write our web service
interface so that new methods do not break existing consumers.

Some people would have us write web methods like this:
Code:

// this is very granular
[WebMethod]
public int CreateClient(string clientName, string clientId, string address1,
string address2){}

Others would have us write the method like this....
// this is very object oriented and less granular
[WebMethod]
public int CreateClient(ClientDocument clientToAdd){}
And others would have us write the method like this:
// this is very generic
[WebMethod]
public int CreateClient(string manifest, string payload){}
I think the only people that agree on the first example, are the architects
that have never maintained code or written code for backward compatibility,
so 90% of all the tech leads and developers do not dig the first approach.

The majority of the shop thinks the second approach is preferred because in
the event that you need to add new methods, you just add them and redeploy
the web service. Meanwhile, existing clients work the same and new clients
consume the new method with the new foot print. I also beleive that we can
base our services around an Interface and use the adapter pattern to create
new functionality.

People that prefer the third approach are relying on the client passing in a
proper manifest definition. The contents of the manifest variable would be
used to load a factory that parsed the payload into business objects, and
then delegated the work to a template method in the factory object. The
template method of the factory object would invoke an xml reader and parse
the payload and do the work. My personal opinion is that this puts too much
weight on the consumer of the service, meaning that the consumer has to know
too much about the method they are invoking.

So my personal feeling is that the second method is the way to go. Since
everyone knows what opinons are like, i.e. everyone has one, I thought I
would ping the users of my favorite forum and see how the other down to earth
people handle versioning of web services.

I did read this article on the MSDN site, but I think it might be a bit
dated.
http://msdn.microsoft.com/webservice...ebserv/toc.asp
May 10 '06 #1
3 1253
Actually, in my first post, I posted the wrong link, here is the article that
I read concerning extending an interface...
http://msdn.microsoft.com/webservice...ce04032002.asp
May 10 '06 #2
I don't like the 3rd method at all. It requires smarts on the client side,
and you have to distribute some sort of specification because the format of
the manifest and the payload is not self evident through the web service.
Additionaly you need more error handling and reporting - Yuck. Instead of
doing this, I would think it would be easier just to write seperate web
services with the same method names, but requiring different parameters.
It's sort of an inheritance mechanism and doesn't require manifest
information.

The first method is very explicit which is nice, but I agree that it does
not lend itself well to maintenance and evlolution.
"DevilDog74" <De********@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
There is some debate on what an ideal web service interface would look
like
at my organization. The debate revolves around how to write our web
service
interface so that new methods do not break existing consumers.

Some people would have us write web methods like this:
Code:

// this is very granular
[WebMethod]
public int CreateClient(string clientName, string clientId, string
address1,
string address2){}

Others would have us write the method like this....
// this is very object oriented and less granular
[WebMethod]
public int CreateClient(ClientDocument clientToAdd){}
And others would have us write the method like this:
// this is very generic
[WebMethod]
public int CreateClient(string manifest, string payload){}
I think the only people that agree on the first example, are the
architects
that have never maintained code or written code for backward
compatibility,
so 90% of all the tech leads and developers do not dig the first approach.

The majority of the shop thinks the second approach is preferred because
in
the event that you need to add new methods, you just add them and redeploy
the web service. Meanwhile, existing clients work the same and new clients
consume the new method with the new foot print. I also beleive that we can
base our services around an Interface and use the adapter pattern to
create
new functionality.

People that prefer the third approach are relying on the client passing in
a
proper manifest definition. The contents of the manifest variable would be
used to load a factory that parsed the payload into business objects, and
then delegated the work to a template method in the factory object. The
template method of the factory object would invoke an xml reader and parse
the payload and do the work. My personal opinion is that this puts too
much
weight on the consumer of the service, meaning that the consumer has to
know
too much about the method they are invoking.

So my personal feeling is that the second method is the way to go. Since
everyone knows what opinons are like, i.e. everyone has one, I thought I
would ping the users of my favorite forum and see how the other down to
earth
people handle versioning of web services.

I did read this article on the MSDN site, but I think it might be a bit
dated.
http://msdn.microsoft.com/webservice...ebserv/toc.asp

May 10 '06 #3
The granular method is universally callable and can easily be versioned. The
server-side constuctors are a much better place to handle the version
changes. You'll also have a good place to put comments explaining why you
made each change. You can't go wrong with this method.

[WebMethod]
public int CreateClient(string clientName, string clientId, string address1,
string address2){
ClientDocument client = new
ClientDocument(clientName,clientId,address1,addres s2);
return client.Create();
}

[WebMethod]
public int CreateClient_2(string clientName, string clientId, string
address1,
string address2, string state){
ClientDocument client = new
ClientDocument(clientName,clientId,address1,addres s2,state);
return client.Create();
}

[WebMethod]
public int CreateClient_3(string clientName, string clientId, string
address1,
string address2, string state, string zip){
ClientDocument client = new
ClientDocument(clientName,clientId,address1,addres s2.state.zip);
return client.Create();
}

May 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Sandman | last post by:
Hello - I suppose this group could be suitable for my questions... I am interested in a versioning system that works good for web authoring. I don't know what differences web development might...
2
by: PatrickSA | last post by:
Hi, Am new to web services, so apologies for the basic nature of the question - and apologies in advance if this is the wrong newsgroup. We're building a new web service and I'm looking around...
0
by: Martin | last post by:
Hey, I am currently writing a WebService ("Server") and a WinApp ("Client") so that a user can use a third program through the web. To do that the client needs a table from a database. Here...
1
by: MrNobody | last post by:
Is there any way to have .NET IDE to handle versioning for your application? If for example you want a certain build number to increment every time you build your project? Would need this version...
3
by: Modica82 | last post by:
Hi all, Does anyone have any views/information on the best way to version web services. I am writing a proposal on how the company should handle versioning of its web services and would like...
1
by: zacks | last post by:
Am using VB.NET 2005. I have a solution that has four projects. Two projects are standard windows applications. One is a class library that is shared by the two windows application projects, it...
1
by: betbubble | last post by:
I replicate (transactional replication) my data entry database to a read-only database. Both are SQL 2000+SP4. The web server reads the read-only database. At times, there will be lots of changes...
4
by: =?Utf-8?B?U2NvdHQ=?= | last post by:
I have seen many articles describing why versioning web services are important. I have a scenario that I would like to propose to seek a solution. I have a publicly consumable web service. Two...
1
by: Coaster | last post by:
orig ref here http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/ff29cc370678911d/c0db5b7e3da283b9?lnk=st&q=gac+assembly+new+version&rnum=7#c0db5b7e3da283b9...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.