.Net Consuming Web Service: Identical Types in Two Different Services

I need to use 2 different web services. Both contain a definition for the user object.

When I refer to services using the Add Service Link link, I provide each service with a unique namespace:

com.xyz.appname.ui.usbo.UserManagement    
com.xyz.appname.ui.usbo.AgencyManagement

The problem is that each of the proxies created contains a new custom class. One is at com.xyz.appname.ui.usbo.UserManagement.user, and the other is at com.xyz.appname.ui.usbo.AgencyManagement.user. However, the user objects are identical, and I would like to consider them as such.

Is it possible to somehow refer to a user object as one object instead of considering them as two different?

I am using .Net 3.5 to use the service. The consumed service is written in Java.

Thanks!!

Edit:

This forum topic is very close to the answer, but the accepted answer was for sharing types from the client and server - which I can not do because we cross platforms (Java in .Net). The real question is: is there a parameter / type of type sharetypes for svcutil in WCF?

+5
source share
5 answers

As a result, I worked with svcutil.exe with all the WSDL addresses from which I needed to generate the code. SVCUTIL will look at all types from each service and automatically determine which ones are shared and should be reused.

, , -, .

+3

WSDL .

/sharetypes
    Turns on type sharing feature. This feature creates one code file with
    a single type definition for identical types shared between different
    services (namespace, name and wire signature must be identical).
    Reference the services with http:// URLs as command-line parameters
    or create a discomap document for local files.
+2

, :

wsdl.exe /sharetypes file://c:\path\to\file.wsdl file://c:\path\to\otherFile.wsdl /namespace:<your namespace> /output:(any switches etc...)

, URL- , wsdl .

+2

- .

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

, , .

, - , .

+1

You can put the user type in a common general assembly that references both services and the client project. Then, in the configuration for both service clients, you can choose the option of reusing types in referenced assemblies. Thus, you are using a type in asssembly, not a separately created class.

0
source

All Articles