SVCUtil 跳过 wsdl 的 complexType 以避免重复 [英] SVCUtil skip complexType of a wsdl to avoid duplicates

查看:21
本文介绍了SVCUtil 跳过 wsdl 的 complexType 以避免重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地下载了多个 wsdl 文件 - A.WSDL 和 B.WSDL

I have multiple wsdl files downloaded on my local - A.WSDL and B.WSDL

A.WSDL 与 B.WSDL 具有相同的复杂类型集(近 100 个) 但方法/操作不同.

A.WSDL has same set of complex type (nearly 100) as that of B.WSDL <xsd:complexType name="Book"> but the methods/operations are different.

例如:A.WSDL 具有复杂类型 和操作正在创建新操作

For Example: A.WSDL has complex type <xsd:complexType name="Book"> and operations being create new operations

B.WSDL 具有相同的复杂类型 和操作是读取操作

B.WSDL has same complex type <xsd:complexType name="Book"> and operations being read operations

我正在使用 SVCUtil 在客户端生成存根到单个文件和具有相同命名空间的存根.但得到以下错误:

I am using SVCUtil to generate stubs on the client end to a single file and stubs with the same namespace. But getting the below error:

错误:验证导出期间生成的某些 XML 架构时出错:已经声明了 complexType http://mylocalhost/object:Book.

Error: There was an error verifying some XML Schemas generated during export: The complexType http://mylocalhost/object:Book has already been declared.

约束条件是:

1) 我将无法更改 WSDL 文件.

1) I will not be able to change the WSDL files.

2) 想将生成的存根类放在单个命名空间中.

2) Would like to place the generated stub classes in single name space.

3) 没有 wsdl.exe

3) No wsdl.exe

有什么办法可以跳过或覆盖重复的 complexType 吗?

Is there any way that either the duplicated complexType could be skipped or could be overwritten?

推荐答案

我通过编写批处理文件来做到这一点.

I did this by writing a batch file.

方法是1) 使用 SVCUtil 为 A.wsdl 创建代理类

The approach was 1) Create proxy classes for A.wsdl using SVCUtil

2) 将它们编译为 .dll 文件

2) Compile them to .dll files

3) 为 B.wsdl 创建代理类,引用 #2 中使用 SVCUtil 创建的 dll 文件.

3) Create proxy classes for B.wsdl referencing to the dll file created in #2 using SVCUtil.

以下是代码行:

"Your_Windows_SDK_Path\Bin\SvcUtil.exe" A.wsdl/language:C#/out:A.cs

"Your_Windows_.NetFramework_Path\csc.exe"/target:library/out:myreferences.dll A.cs

"Your_Windows_SDK_Path\Bin\SvcUtil.exe" B.wsdl/r:myreferences.dll/language:C#/out:B.cs/mergeconfig/config:output.config`

这篇关于SVCUtil 跳过 wsdl 的 complexType 以避免重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆