I have to consume 2 different web services. Both contain a definition for a 'user' object.
When I reference the services using "Add service reference" I give each service a unique namespace:
com.xyz.appname.ui.usbo.UserManagement
com.xyz.appname.ui.usbo.AgencyManagement
The problem I have is that each one of the proxies that are generated contain a new user class. One is located at com.xyz.appname.ui.usbo.UserManagement.user and the other at com.xyz.appname.ui.usbo.AgencyManagement.user. However, the user objects are identical and I would like to treat them as such.
Is there a way that I can somehow reference the user object as one object instead of treating them as two different?
I am using .Net 3.5 to consume the service. The service being consumed is written in Java.
Thanks!!
Edit:
This forum thread got very close to an answer, but the accepted answer ended up being to share types from client and server - which I cannot do because we're crossing platforms (Java to .Net). The real question is, is there a /sharetypes type of parameter for svcutil in WCF?
What ended up working for me was to provide the svcutil.exe all WSDL addresses that I needed to generate code from. SVCUTIL will look at all the types from each service and determine automatically which ones are common and should be re-used.
The type that you want to be shared should also have a shared namespace, and that namespace should be called out on each of the webservices that want to share that type.
the WSDL tool has a parameter.
/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.
If you're working with local files you can do the following:
wsdl.exe /sharetypes file://c:\path\to\file.wsdl file://c:\path\to\otherFile.wsdl /namespace:<your namespace> /output:(any switches etc...)
The sharetypes switch requires that you provide URLs to the services, and doesn't work if you simply point wsdl at the files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With