473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1273
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.