473,385 Members | 1,445 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,385 software developers and data experts.

Versioning web services

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 different clients, A and B,
consume this service. I make framework and architecture modifications that
are needed to my web services. Client "A" is ready for the upgrade while
client "B" is not ready. I have to publish the update immediately for client
"A" to continue to work with me, but client "B" needs to be able to
continually operate as if nothing has been modified. Without having seperate
web service locations published, how would I accomplish this task?

To keep it simple web method GetData(int id, string Description) is consumed
by both client "A" and "B". Without changing the signature, location, or
anything that is visible to the client, except the return data for client
"A", how do I provide a mechanism for client "A" to be processed by the new
architecture and client "B" to be processed by the old architecture.
Feb 7 '07 #1
4 1967
Scott,

I am proposing a solution that will work if it is implemented in the web
service/client code from the very beginning, before asking the clients to use
a newer version of your service.

Define a SoapHeader in the web service that will store the version of your
service in a data member.
Apply the SoapHeader attribute to your web method.
Write code inside your web method to read the value of the SoapHeader data
member (that is set from the client code) and to perform different logic
based on the value of this data member.

On the client, write code like this:
using System;

public class Sample {

public static void Main() {
MyWebService ws = new MyWebService();

try {
MyHeader customHeader = new MyHeader();
customHeader.MyVersion = "Header Value for MyVersion";
customHeader.MustUnderstand = true;
ws.myHeader = customHeader;

int results = ws.MyWebMethod();
}
catch (Exception e) {
Console.WriteLine ("Exception: {0}", e.ToString());
}
}
}

You can set customHeader.MyVersion reading a configuration file parameter
(web.config, etc).

In this way, when you add new logic into your web method and create a new
web service version, ask the client to modify the configuration file and set
the value for the SoapHeader to your new version number.

I have to test this to see if it works.

Here is a MS link:
http://msdn2.microsoft.com/en-us/library/y4t36w86.aspx

Hope it helps,
Eugen

"Scott" wrote:
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 different clients, A and B,
consume this service. I make framework and architecture modifications that
are needed to my web services. Client "A" is ready for the upgrade while
client "B" is not ready. I have to publish the update immediately for client
"A" to continue to work with me, but client "B" needs to be able to
continually operate as if nothing has been modified. Without having seperate
web service locations published, how would I accomplish this task?

To keep it simple web method GetData(int id, string Description) is consumed
by both client "A" and "B". Without changing the signature, location, or
anything that is visible to the client, except the return data for client
"A", how do I provide a mechanism for client "A" to be processed by the new
architecture and client "B" to be processed by the old architecture.
Feb 9 '07 #2
The challenge with this approach is that the client is required to modify
exisitng code and the exisiting implementation they may have. In a situation
where I have no control or ability to dictate to the client to change, this
would not be a plausable option.

I did consider something similar to this approach and appreciate the input.
I really need a solution in which the modifcation is totally transparent to
the client in the manner of consumption. It would be OK if the client could
tell they are consuming a different service, but not OK for them to have to
modify their current base.

Would an approach of using an HTTP Handler to intercept the request, access
a hash table for the appropriate version, then route to the appropriate
version be plausable I wonder? The trick is whether or not I could determine
the "Who" in the request, then route that request to the appropriate version.
My thoughts are to implement something like an interface, where the client
is consuming a service which is nothing more than a generic signature which
determines the "who, where, and what". Any thoughts?

"Eugen" wrote:
Scott,

I am proposing a solution that will work if it is implemented in the web
service/client code from the very beginning, before asking the clients to use
a newer version of your service.

Define a SoapHeader in the web service that will store the version of your
service in a data member.
Apply the SoapHeader attribute to your web method.
Write code inside your web method to read the value of the SoapHeader data
member (that is set from the client code) and to perform different logic
based on the value of this data member.

On the client, write code like this:
using System;

public class Sample {

public static void Main() {
MyWebService ws = new MyWebService();

try {
MyHeader customHeader = new MyHeader();
customHeader.MyVersion = "Header Value for MyVersion";
customHeader.MustUnderstand = true;
ws.myHeader = customHeader;

int results = ws.MyWebMethod();
}
catch (Exception e) {
Console.WriteLine ("Exception: {0}", e.ToString());
}
}
}

You can set customHeader.MyVersion reading a configuration file parameter
(web.config, etc).

In this way, when you add new logic into your web method and create a new
web service version, ask the client to modify the configuration file and set
the value for the SoapHeader to your new version number.

I have to test this to see if it works.

Here is a MS link:
http://msdn2.microsoft.com/en-us/library/y4t36w86.aspx

Hope it helps,
Eugen

"Scott" wrote:
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 different clients, A and B,
consume this service. I make framework and architecture modifications that
are needed to my web services. Client "A" is ready for the upgrade while
client "B" is not ready. I have to publish the update immediately for client
"A" to continue to work with me, but client "B" needs to be able to
continually operate as if nothing has been modified. Without having seperate
web service locations published, how would I accomplish this task?

To keep it simple web method GetData(int id, string Description) is consumed
by both client "A" and "B". Without changing the signature, location, or
anything that is visible to the client, except the return data for client
"A", how do I provide a mechanism for client "A" to be processed by the new
architecture and client "B" to be processed by the old architecture.
Feb 12 '07 #3
Hi Scott,

I was thinking in the same way as you, from a COM perspective, creating an
interface.

What I understand it is missing in this approach is a proxy on the server.

If I will be able to know on the server that a particular client is using
these set of methods from the service and another client is using a newer
version of the service, meaning another set of methods, than the problems
will be solved.

However, calling web services works over SOAP and the only thing you can do
is to modify the SOAP message that a client is sending to the server. So far,
I know that this means writting code on the client and server, creating SOAP
Extentions, etc. This is not the solution you are looking for.

I have found an article describing the WSDL of the web services in details
and I suggest for you to read it too. Here is the link:

http://msdn2.microsoft.com/en-gb/library/ms996434.aspx

Pay attention to Port Types: "Conceptually, portTypes are very similar to
interfaces that group together related methods, properties, fields, and
events."

I have to read better this article myself and try experiment creating some
interfaces, if possible.

Best regards,
Eugen
"Scott" wrote:
The challenge with this approach is that the client is required to modify
exisitng code and the exisiting implementation they may have. In a situation
where I have no control or ability to dictate to the client to change, this
would not be a plausable option.

I did consider something similar to this approach and appreciate the input.
I really need a solution in which the modifcation is totally transparent to
the client in the manner of consumption. It would be OK if the client could
tell they are consuming a different service, but not OK for them to have to
modify their current base.

Would an approach of using an HTTP Handler to intercept the request, access
a hash table for the appropriate version, then route to the appropriate
version be plausable I wonder? The trick is whether or not I could determine
the "Who" in the request, then route that request to the appropriate version.
My thoughts are to implement something like an interface, where the client
is consuming a service which is nothing more than a generic signature which
determines the "who, where, and what". Any thoughts?

"Eugen" wrote:
Scott,

I am proposing a solution that will work if it is implemented in the web
service/client code from the very beginning, before asking the clients to use
a newer version of your service.

Define a SoapHeader in the web service that will store the version of your
service in a data member.
Apply the SoapHeader attribute to your web method.
Write code inside your web method to read the value of the SoapHeader data
member (that is set from the client code) and to perform different logic
based on the value of this data member.

On the client, write code like this:
using System;

public class Sample {

public static void Main() {
MyWebService ws = new MyWebService();

try {
MyHeader customHeader = new MyHeader();
customHeader.MyVersion = "Header Value for MyVersion";
customHeader.MustUnderstand = true;
ws.myHeader = customHeader;

int results = ws.MyWebMethod();
}
catch (Exception e) {
Console.WriteLine ("Exception: {0}", e.ToString());
}
}
}

You can set customHeader.MyVersion reading a configuration file parameter
(web.config, etc).

In this way, when you add new logic into your web method and create a new
web service version, ask the client to modify the configuration file and set
the value for the SoapHeader to your new version number.

I have to test this to see if it works.

Here is a MS link:
http://msdn2.microsoft.com/en-us/library/y4t36w86.aspx

Hope it helps,
Eugen

"Scott" wrote:
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 different clients, A and B,
consume this service. I make framework and architecture modifications that
are needed to my web services. Client "A" is ready for the upgrade while
client "B" is not ready. I have to publish the update immediately for client
"A" to continue to work with me, but client "B" needs to be able to
continually operate as if nothing has been modified. Without having seperate
web service locations published, how would I accomplish this task?
>
To keep it simple web method GetData(int id, string Description) is consumed
by both client "A" and "B". Without changing the signature, location, or
anything that is visible to the client, except the return data for client
"A", how do I provide a mechanism for client "A" to be processed by the new
architecture and client "B" to be processed by the old architecture.
Feb 12 '07 #4
Hi Scott,

I am thinking to another idea where you can use reflection.

Your web service method can have a third parameter that will contains a
collection of Interfaces or Methods defined in the web service.

Since the client call to
"method(param1,param2,service.GetType().GetInterfa ces()) "
will send a list of interfaces from the client web service proxy, that is,
only the interfaces defined at the time the client referenced the service,
you will be able to make the distinction on the server between a client
version and another.

A newer client will use a new reference of a service, hence using a new
interface defined by you that the first client will be missing.

Serialization may be a problem for the third parameter; I passed an
ArrayList in a web service call some time ago so at least this can work.

What do you think, could this idea be a possible solution?

Eugen

"Eugen" wrote:
Hi Scott,

I was thinking in the same way as you, from a COM perspective, creating an
interface.

What I understand it is missing in this approach is a proxy on the server.

If I will be able to know on the server that a particular client is using
these set of methods from the service and another client is using a newer
version of the service, meaning another set of methods, than the problems
will be solved.

However, calling web services works over SOAP and the only thing you can do
is to modify the SOAP message that a client is sending to the server. So far,
I know that this means writting code on the client and server, creating SOAP
Extentions, etc. This is not the solution you are looking for.

I have found an article describing the WSDL of the web services in details
and I suggest for you to read it too. Here is the link:

http://msdn2.microsoft.com/en-gb/library/ms996434.aspx

Pay attention to Port Types: "Conceptually, portTypes are very similar to
interfaces that group together related methods, properties, fields, and
events."

I have to read better this article myself and try experiment creating some
interfaces, if possible.

Best regards,
Eugen
"Scott" wrote:
The challenge with this approach is that the client is required to modify
exisitng code and the exisiting implementation they may have. In a situation
where I have no control or ability to dictate to the client to change, this
would not be a plausable option.

I did consider something similar to this approach and appreciate the input.
I really need a solution in which the modifcation is totally transparent to
the client in the manner of consumption. It would be OK if the client could
tell they are consuming a different service, but not OK for them to have to
modify their current base.

Would an approach of using an HTTP Handler to intercept the request, access
a hash table for the appropriate version, then route to the appropriate
version be plausable I wonder? The trick is whether or not I could determine
the "Who" in the request, then route that request to the appropriate version.
My thoughts are to implement something like an interface, where the client
is consuming a service which is nothing more than a generic signature which
determines the "who, where, and what". Any thoughts?

"Eugen" wrote:
Scott,
>
I am proposing a solution that will work if it is implemented in the web
service/client code from the very beginning, before asking the clients to use
a newer version of your service.
>
Define a SoapHeader in the web service that will store the version of your
service in a data member.
Apply the SoapHeader attribute to your web method.
Write code inside your web method to read the value of the SoapHeader data
member (that is set from the client code) and to perform different logic
based on the value of this data member.
>
On the client, write code like this:
using System;
>
public class Sample {
>
public static void Main() {
MyWebService ws = new MyWebService();
>
try {
MyHeader customHeader = new MyHeader();
customHeader.MyVersion = "Header Value for MyVersion";
customHeader.MustUnderstand = true;
ws.myHeader = customHeader;
>
int results = ws.MyWebMethod();
}
catch (Exception e) {
Console.WriteLine ("Exception: {0}", e.ToString());
}
}
}
>
You can set customHeader.MyVersion reading a configuration file parameter
(web.config, etc).
>
In this way, when you add new logic into your web method and create a new
web service version, ask the client to modify the configuration file and set
the value for the SoapHeader to your new version number.
>
I have to test this to see if it works.
>
Here is a MS link:
http://msdn2.microsoft.com/en-us/library/y4t36w86.aspx
>
Hope it helps,
Eugen
>
"Scott" wrote:
>
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 different clients, A and B,
consume this service. I make framework and architecture modifications that
are needed to my web services. Client "A" is ready for the upgrade while
client "B" is not ready. I have to publish the update immediately for client
"A" to continue to work with me, but client "B" needs to be able to
continually operate as if nothing has been modified. Without having seperate
web service locations published, how would I accomplish this task?

To keep it simple web method GetData(int id, string Description) is consumed
by both client "A" and "B". Without changing the signature, location, or
anything that is visible to the client, except the return data for client
"A", how do I provide a mechanism for client "A" to be processed by the new
architecture and client "B" to be processed by the old architecture.
Feb 12 '07 #5

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...
3
by: DevilDog74 | last post by:
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...
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.