473,573 Members | 2,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web Service interface versioning...

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 for documentation on a number of
issues, including versioning of web service interfaces...

I've spent the last few hours looking through books, Google, MSDN and
surprisingly I have found little or nothing that explains/shows how to
practically handle the evolution of a web service's interface over time. One
would have thought that this would be one topic where there would be an
abundance of information.

Our requirements for versioning a web service interface are:

(a) To ensure that a previously published interface never changes, so that
older clients still work: this can be further classified to include (i)
changes to method signatures, and (ii) changes to custom types passed in/out
to these methods

(b) To ensure that new interfaces are a superset of any existing old
interfaces, with the additional requirement that no code is repeated, so the
methods in the new interfaces that are the same as the old interface, simply
delegate calls to existing methods rather than repeating code.

(c) To keep the URL to the WSDL the same for all versions - in my opinion, a
WSDL is a description of a web service, and not the description of a version
of a webservice - I have seen many implementations of web service versioning
that simply use a different WSDL for each version - although it somewhat
works, I'm not sure that this is the ideal solution.

(d) To make all the changes in C# code (using attribute decoration), without
having to resort to directly modifying WSDL's or XSD files, especially after
auto-generation - in other words, we want to be able to use the built-in
web-service-related attributes within Visual Studio.NET to decorate our code
and not poke around modifying system-generated files...

The little that I've found, I list below along with why the
solution/explanation is not ideal (based on my understanding) for our
particular needs - both of them were written (wholly or partly) by Scott
Seely sometime in 2002:

(1)
http://msdn.microsoft.com/library/de...ce10152002.asp
This is a good article however with regards to adding new code it opts for
either having two ASMX files or manually editing the WSDL both of which are
not very attractive. For changing method signatures, it opts again for
having two separate ASMX files which again is not attractive.

(2)
http://msdn.microsoft.com/library/de...ce04032002.asp
Again another good article, however no references are made to the use of
attributes within C# code - the main thrust of this article is that
versioning should be done via the TargetNamespace
([WebService(Name space="http://www.somecompany .com/Version1")]), which from
within VS.NET can be set as an attribute of the just above the Service class
(which inherits from System.Web.Serv ices.WebService ). From reading this, I
got the idea to put a new version of the web service into a second class
(within the same overall C# class (not XML!) namespace) also inheriting from
System.Web.Serv ices.WebService , but this time decorate that class with a
different TargetNameSpace , for example
[WebService(Name space="http://www.somecompany .com/Version2")] - this way, I
could have two separate classes representing each web service versions, with
each class being decorated by a versioned TargetNamespace , whilst still
sharing the same ASMX/URL.

The sample code I came up with is below (business logic has been replaced
with Apples and Pears and Oranges for IP reasons, however the mechanics are
the same). What I found is that when I run the service, only the methods
from the first class that is declared show up as being methods on the service
- the second class with the separate target namespace appears to be
completely ignored.

When I request a WSDL from the service, this also appears to reflect the
fact that the second class is completely ignored - what am I doing wrong?
Have I adopted the wrong approach? Is what I'm looking for (the 4 points (a)
to (d) above) impossible to achieve? Is there something very basic that I'm
missing?

Frankly, I find it hard to believe that there are no more than the two
complete articles listed above available on the net for web service
versioning using .NET, however I can't find any more! Any pointers to
documentation, in-code attributes, suggestions to fix my approach above or
even sample code etc for me to read up on would be extremely welcome...

Kind regards
Patrick

~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ Code pasted below:

using System;
using System.Web;
using System.Web.Serv ices;
using System.Componen tModel;
using System.Web.Serv ices.Protocols;

namespace SomeWebService
{
[Serializable()]
public class Apple
{
public string name;
public int age;

public Apple()
{
name = @"";
}
}

[Serializable()]
public class Pear
{
public string name;
public int age;
public Pear()
{
name = @"";
}
}

[Serializable()]
public class Orange
{
public string name;
public int age;
public Orange()
{
name = @"";
}
}

/// <summary>
/// Summary description for Service.
/// </summary>
[WebService(Name space="http://www.somecompany .com/V1")]
public class Service1 : System.Web.Serv ices.WebService
{
public Service1()
{
InitializeCompo nent();
}

#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Disp ose();
}
base.Dispose(di sposing);
}
#endregion

[WebMethod]
public Apple[] GetAppleList()
{
Apple[] apples = new Apple[ 3 ];
Apple a = new Apple();
a.name = @"Granny Smith";
a.age = 3;
apples[0] = a;

a = new Apple();
a.name = @"Golden Shine";
a.age = 4;
apples[1] = a;

a = new Apple();
a.name = @"Crunchy Green";
a.age = 5;
apples[2] = a;

return apples;
}

[WebMethod]
public Pear[] GetPearList()
{
Pear[] pears = new Pear[ 2 ];
Pear p = new Pear();
p.name = @"Avocado";
p.age = 9;
pears[0] = p;

p = new Pear();
p.name = @"Fruity Pear";
p.age = 10;
pears[1] = p;

return pears;
}
}

/// <summary>
/// Summary description for Service.
/// </summary>
[WebService(Name space="http://www.somecompany .com/V2")]
public class Service2 : System.Web.Serv ices.WebService
{
public Service2()
{
InitializeCompo nent();
}

#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Disp ose();
}
base.Dispose(di sposing);
}
#endregion

[WebMethod]
public Apple[] GetAppleList()
{
Service1 s = new Service1();
return s.GetAppleList( );
}

[WebMethod]
public Pear[] GetPearList()
{
Service1 s = new Service1();
return s.GetPearList() ;
}

[WebMethod]
public Orange[] GetOrangeList()
{
Orange[] oranges = new Orange[ 2 ];
Orange o = new Orange();
o.name = @"Mandarin";
o.age = 9;
oranges[0] = o;

o = new Orange();
o.name = @"Tangarine" ;
o.age = 10;
oranges[1] = o;

return oranges;
}
}
}

Nov 22 '05 #1
2 3634
hB
So What is the OPTIMAL solution found?
Or guys tell/guide us the alternatives/workarounds!

---
hB

Nov 22 '05 #2
Hello

I am not an expert on Semantic Webs and Ontologies but this is really some
thing that makes us think about the limitations of current WS Architecture.
For any approach (listed by you or otherwise) that we take to resolve such
issues would most probably be a workaround. Smeantic Web Services is one
initiative that is working to resolve such issuses. Following is an extract
from there mission statement.

The SWSI mission is threefold:
to create infrastructure that combines Semantic Web and Web Services
technologies to enable maximal automation and dynamism in all aspects of Web
service provision and use, including (but not limited to) discovery,
selection, composition, negotiation, invocation, monitoring and recovery; to
coordinate ongoing research initiatives in the Semantic Web Services area;
to promote the results of SWSI work to academia and industry.

I would also suggest you to take a look at following links:

http://www.swsi.org/
http://www.wsmo.org/TR/d2/v1.1/
http://www.wsmo.org/TR/d13/d13.4/v0.1


"PatrickSA" wrote:
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 for documentation on a number of
issues, including versioning of web service interfaces...

I've spent the last few hours looking through books, Google, MSDN and
surprisingly I have found little or nothing that explains/shows how to
practically handle the evolution of a web service's interface over time. One
would have thought that this would be one topic where there would be an
abundance of information.

Our requirements for versioning a web service interface are:

(a) To ensure that a previously published interface never changes, so that
older clients still work: this can be further classified to include (i)
changes to method signatures, and (ii) changes to custom types passed in/out
to these methods

(b) To ensure that new interfaces are a superset of any existing old
interfaces, with the additional requirement that no code is repeated, so the
methods in the new interfaces that are the same as the old interface, simply
delegate calls to existing methods rather than repeating code.

(c) To keep the URL to the WSDL the same for all versions - in my opinion, a
WSDL is a description of a web service, and not the description of a version
of a webservice - I have seen many implementations of web service versioning
that simply use a different WSDL for each version - although it somewhat
works, I'm not sure that this is the ideal solution.

(d) To make all the changes in C# code (using attribute decoration), without
having to resort to directly modifying WSDL's or XSD files, especially after
auto-generation - in other words, we want to be able to use the built-in
web-service-related attributes within Visual Studio.NET to decorate our code
and not poke around modifying system-generated files...

The little that I've found, I list below along with why the
solution/explanation is not ideal (based on my understanding) for our
particular needs - both of them were written (wholly or partly) by Scott
Seely sometime in 2002:

(1)
http://msdn.microsoft.com/library/de...ce10152002.asp
This is a good article however with regards to adding new code it opts for
either having two ASMX files or manually editing the WSDL both of which are
not very attractive. For changing method signatures, it opts again for
having two separate ASMX files which again is not attractive.

(2)
http://msdn.microsoft.com/library/de...ce04032002.asp
Again another good article, however no references are made to the use of
attributes within C# code - the main thrust of this article is that
versioning should be done via the TargetNamespace
([WebService(Name space="http://www.somecompany .com/Version1")]), which from
within VS.NET can be set as an attribute of the just above the Service class
(which inherits from System.Web.Serv ices.WebService ). From reading this, I
got the idea to put a new version of the web service into a second class
(within the same overall C# class (not XML!) namespace) also inheriting from
System.Web.Serv ices.WebService , but this time decorate that class with a
different TargetNameSpace , for example
[WebService(Name space="http://www.somecompany .com/Version2")] - this way, I
could have two separate classes representing each web service versions, with
each class being decorated by a versioned TargetNamespace , whilst still
sharing the same ASMX/URL.

The sample code I came up with is below (business logic has been replaced
with Apples and Pears and Oranges for IP reasons, however the mechanics are
the same). What I found is that when I run the service, only the methods
from the first class that is declared show up as being methods on the service
- the second class with the separate target namespace appears to be
completely ignored.

When I request a WSDL from the service, this also appears to reflect the
fact that the second class is completely ignored - what am I doing wrong?
Have I adopted the wrong approach? Is what I'm looking for (the 4 points (a)
to (d) above) impossible to achieve? Is there something very basic that I'm
missing?

Frankly, I find it hard to believe that there are no more than the two
complete articles listed above available on the net for web service
versioning using .NET, however I can't find any more! Any pointers to
documentation, in-code attributes, suggestions to fix my approach above or
even sample code etc for me to read up on would be extremely welcome...

Kind regards
Patrick

~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ Code pasted below:

using System;
using System.Web;
using System.Web.Serv ices;
using System.Componen tModel;
using System.Web.Serv ices.Protocols;

namespace SomeWebService
{
[Serializable()]
public class Apple
{
public string name;
public int age;

public Apple()
{
name = @"";
}
}

[Serializable()]
public class Pear
{
public string name;
public int age;
public Pear()
{
name = @"";
}
}

[Serializable()]
public class Orange
{
public string name;
public int age;
public Orange()
{
name = @"";
}
}

/// <summary>
/// Summary description for Service.
/// </summary>
[WebService(Name space="http://www.somecompany .com/V1")]
public class Service1 : System.Web.Serv ices.WebService
{
public Service1()
{
InitializeCompo nent();
}

#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Disp ose();
}
base.Dispose(di sposing);
}
#endregion

[WebMethod]
public Apple[] GetAppleList()
{
Apple[] apples = new Apple[ 3 ];
Apple a = new Apple();
a.name = @"Granny Smith";
a.age = 3;
apples[0] = a;

a = new Apple();
a.name = @"Golden Shine";
a.age = 4;
apples[1] = a;

a = new Apple();
a.name = @"Crunchy Green";
a.age = 5;
apples[2] = a;

return apples;
}

[WebMethod]
public Pear[] GetPearList()
{
Pear[] pears = new Pear[ 2 ];
Pear p = new Pear();
p.name = @"Avocado";
p.age = 9;
pears[0] = p;

p = new Pear();
p.name = @"Fruity Pear";
p.age = 10;
pears[1] = p;

return pears;
}
}

/// <summary>
/// Summary description for Service.
/// </summary>
[WebService(Name space="http://www.somecompany .com/V2")]
public class Service2 : System.Web.Serv ices.WebService
{
public Service2()
{
InitializeCompo nent();
}

#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Disp ose();
}
base.Dispose(di sposing);
}
#endregion

[WebMethod]
public Apple[] GetAppleList()
{
Service1 s = new Service1();
return s.GetAppleList( );
}

[WebMethod]
public Pear[] GetPearList()
{
Service1 s = new Service1();
return s.GetPearList() ;
}

[WebMethod]
public Orange[] GetOrangeList()
{
Orange[] oranges = new Orange[ 2 ];
Orange o = new Orange();
o.name = @"Mandarin";
o.age = 9;
oranges[0] = o;

o = new Orange();
o.name = @"Tangarine" ;
o.age = 10;
oranges[1] = o;

return oranges;
}
}
}

Nov 22 '05 #3

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

Similar topics

2
528
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 for documentation on a number of issues, including versioning of web service interfaces... I've spent the last few hours looking through books,...
4
3894
by: yoz | last post by:
Hi everyone, I wonder if you can shed some light on a problem I have. I am exporting a C# .Net set of classes to COM. All of it is exported properly but the interface inheritences are not in the type library. for example: public interface IA {
20
4234
by: Ole Hanson | last post by:
I am accessing my database through an interface, to allow future substitution of the physical datastore - hence I would like to declare in my Interface that my DAL-objects implementing the interface and accessing the datastore MUST pass in a UserToken in the constructor of the object. Is this not possible? Am I forced to add the UserToken...
3
3742
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 some of your views. I dont have much at the moment, i am going to gather some research but as i said, any info would be greatly appreciated. ...
4
3986
by: WinDev | last post by:
We are trying to build a system where we have a Windows Service do some manipulation of data, and then sending the data to a Windows App. I had posted a question of how we should do this and was told remoting was the way to go. So I got a client and a server program up and going and from the client I can call a routine in the server...
8
1467
by: khalprin | last post by:
Hello, I'm trying to create a component that will be used from .net clients and COM clients. I've got an object model that looks something like this: ISystem IRuntime IConfiguration ICollectionOfConfigurableThings IConfigurableThing
6
1905
by: dotNeter | last post by:
The services, talked here, are things used in IServiceContainer, IServiceProvider, etc. In my opinion, everything can be a service, and a service is generally used for providing specific features for service consumers, at design time. But, I think the cnsumers must completely know all aspects of that service. This sounds not good, and breaks...
15
13493
by: Joseph Geretz | last post by:
I'm a bit puzzled by the current recommendation not to send Datasets or Datatables between application tiers. http://support.microsoft.com/kb/306134 http://msdn2.microsoft.com/en-us/library/ms996381.aspx Formerly, with classic Microsoft DNA architecture, the ADO Recordset was a primary transport medium, recommended for transmitting data...
1
1936
by: Olie | last post by:
I was quite surprised to find virtually nothing about this but I may have been searching for the wrong thing. I want to know the best way to provide a programming interface to a plugin. I already have a plugin architecture that allows the application to call code in a plugin but I want the plugin to also be able to call code in the...
7
10587
by: WTH | last post by:
I am now aware (I am primarily a C++ developer) that in C# if you reference the same interface from the same file in two different projects the types are actually incompatible. I found this out because I have written a generic plugin system for my current and future C# needs. I defined a base plugin system interface named IPlugin...
0
7746
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7668
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8035
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5556
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3698
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3694
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1269
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
992
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.