.Net Consuming Web Service: Identical types in two different services

前端 未结 5 1863
谎友^
谎友^ 2020-12-17 03:24

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 e

5条回答
  •  一整个雨季
    2020-12-17 03:57

    This is a common situation when consuming webservices with different endpoints from the same provider.

    You can use the "wsdl.exe /sharetypes" command line tool to create a shared proxy class that will look at all of the endpoints that you provide, and infer which classes can be 'shared'.

    In your example, as long as your user object is identical in both services it will get picked up and included in your new shared proxy class.

    It probably makes sense to add this shared proxy class generation step as a build event in your project that way it is always up to date.

提交回复
热议问题