Processing the same class definition from multiple web services

Situation:

We have a library project that stores most of our code for the various integrations that we are working on. Many of the integrations consume the apis web service, and my manager does not want 5 gillion links to web services added to the project.

What we usually do is add a link to a new project and copy References.vb to the solution and just call the generated code. Not very convenient if changes are made to the service, but it works.

Recently, I have had a problem when we have to use 3 web services for the same integration. 2 of them contain the same class definitions, but they are in different namespaces because they belong to different services. This has become a problem for me, because one of the services searches for the user based on the user ID, and the other discards the user blocks. Both return an object or list that is exactly the same semantically. And I need to process the data the same way, regardless of whether they came from one service or another.

My solution was to split the duplicated classes in the service and replace them with classes inherited from common base classes. This allowed me to work with both objects as if they were the same, but for this I had to change the created web service proxy. Therefore, this change will need to be done every time I need to restore the proxy.

I am curious that you all might think that the best solution for this would be.

+3
source share
4 answers

wsdl.exe, /sharetypes, , . , wsdl .

0

Reference.vb .

WCF, , , , , .

, "" , - .

+1

- -, , , ( ) - - . :)

0

, WCF 3.5+, .NET 2.0 - WSCF (First Services Contract First), XML , . , MyComany.WS.Common . , -. .NET 2, . , , , .

.NET 3.5 , WSCF

thinktecture WSCF.

0
source

All Articles