我继承了系统上 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 创建的。
最佳答案
您可能会发现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/