.net - 从 WSDL 文件逆向工程 Web 服务接口(interface)的最佳方法?

标签 .net web-services wsdl reverse-engineering

我继承了系统上 Web 服务的 WSDL 文件,但我无权访问该文件进行开发和测试。

我需要生成一个遵循该 WSDL 的 Web 服务。包装器是 .NET,但如果有一种简单的方法可以在另一个平台上做到这一点,我们也许可以看看。生产 Web 服务是基于 Java 的。

执行此操作的最佳方法是什么?

注意:继承的 wsdl 似乎与 wsdl.exe 不兼容,因为它不符合 WS-I Basic Profile v1.1。 特别是,传递它的组织提到它使用了 Microsoft 工具不支持的另一个标准,但他们没有澄清。该错误与必填的“名称”字段有关:

Error: Element Reference '{namespace}/:viewDocumentResponse' declared in
schema type '' from namespace ''
       - the required attribute 'name' is missing

为了清楚起见,我知道我可以轻松地从 WSDL 文件创建 .NET 包装器类,但这不是我需要的。是这样的:

更新:原始 Web 服务是使用 Axis 创建的。

Diagram of system showing unavailable web service and mock web service http://paulw.us/blog/uploads/SO-WSDL-Question2.gif

最佳答案

您可能会发现command line utility wsdl.exe很有用.NET 通过使用 /serverInterface 选项。根据文档:

Generates interfaces for server-side implementation of an ASP.NET Web Service. An interface is generated for each binding in the WSDL document(s). The WSDL alone implements the WSDL contract (classes that implement the interface should not include either of the following on the class methods: Web Service attributes or Serialization attributes that change the WSDL contract). Short form is '/si'.

关于.net - 从 WSDL 文件逆向工程 Web 服务接口(interface)的最佳方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/234945/

相关文章:

web-services - 如何在 Web 服务调用中输入凭据(授权对象)?

c# - Dapper 读取 SqlHierachyId 列(SQL Server 2008 R2)

c# - 如何在数据契约(Contract) WCF 中使用枚举

c# - 您可以使用 POST 在 Solr (/select) 中运行查询吗

java - 小程序-服务器通信,我该怎么做?

java - 如何解决无法找到请求目标的有效证书路径异常?

java - 无法创建 Web 服务客户端错误

java - 调用 Web 服务时出现 org.xml.sax.SAXParseException 错误

c# - 如何在代码隐藏中访问 TemplateField

c# - 光谱流 : generate tests with underscore between words