从多个Web引用共享数据类型多个、数据类型、Web

2023-09-03 04:24:29 作者:攒一ロ袋βθ光

假设供应商提供了两个独立的Web服务,这两者共享相同的数据类型和相同的命名空间。

Say a vendor has provided two separate webservices, which both share the same data types and same namespace.

例如。 下面web服务都包含相似的对象,例如一个TestCredentials对象

e.g. The following webservices both contain similar objects, such as a TestCredentials object:

TestWebservice / Testwebservice1.asmx TestWebservice / Testwebservice2.asmx

这包括将使用Web引用我结束了与Visual Studio:

Including these into Visual Studio using web references I end up with:

Testwebservice1.TestCredentials Testwebservice2.TestCredentials

当我真正想要的是:

Testwebservice.TestCredentials

有没有办法在Visual Studio中,当与Web引用处理,这两个Web服务连接在一起,这样生成的代理类是相同的(和相同的命名空间内)?

Is there any way in Visual Studio, when dealing with the web references, to link these two webservices together so that the proxy classes that are generated are the same (and within the same namespace)?

推荐答案

另一种可能的选择(还有Wsdl.exe用/ sharetypes)是使用Visual Studio 2008,并使用添加服务引用。在添加服务引用对话框中提供的选项重用类型。

Another possible option (along with wsdl.exe /sharetypes) is to use Visual Studio 2008 and use "Add Service Reference". The "Add Service Reference" dialog provides options to reuse types.