One WCF Service with different XSD/WSDL versions

Viewed 21

I have a problem where I can't find a good solution. Maybe someone can help me.

There is a WCF service and it was created years ago. Now an adjustment has to be made. Here is the scenario:

Example WCF CarService.svc. This WCF has a generated class CarV1.cs which was created from a Car WSDL (v1) with svcutil.exe. Thus, this CarV1.cs contains several classes and properties. In the CarV1.cs there is also an interface CarIdentification which is derived in the CarService.svc.cs. So far so good. Now there is a new version of the Car WSDL (v2). I have also generated a class CarV2.cs from the WSDL with svcutil.exe. Now I have two generated .cs (one v1 and one v2). Apart from a few adjustments (new classes and a few classes have been renamed), the rest is identical in v2, i.e. the class names and names of the properties as well as the name of the interface, both are called CarIdentification.

My problem is that both versions have to be offered and I don't know how to integrate both in WCF. Since both have the same name of the interface, which is derived, and also many classes have the same name. I could make a copy of the whole solution and then offer version 1 and version 2 in the IIS. But I would like to have 1 WCF with both versions. I could also work with multiple endpoints, but how do I do that if most of the names are the same? Is that possible at all? The next thing is that in CarService.svc.cs there is a derived method which is defined in the interface and which has a return value from CarV1.cs. CarV2 of course has the method "GetDetails" as well and I can't address it because it is always referenced to CarV1. I have already tried to address the method with CarV2.GetDetails, but that does not work.

How can I implement the whole thing sensibly? It would be an advantage if I didn't have to adapt the client application that accesses the service.

Thank you

1 Answers

The first problem is that the class parameters created after implementing the interface can be distinguished.

The second problem is that if the method name is the same and cannot be distinguished, it can also be implemented by adding different parameters in the same method name.

Related