使用 XML 目录从 WSDL 生成代码
是否有任何工具可以使用 XML 目录从 WSDL 生成 Java 代码?问题是我有导入 XML 架构的 wsdl 文件,这些文件还导入其他架构,并且这些架构在 schemaLocation url 处不可用。这就是代码生成失败的原因。如果工具能够使用 XML Catalog,则无需修改每个 WSDL 和模式中的每个 schemaLocation 即可解决此问题。
我尝试过 Eclipse 和 Netbeans 插件,但都失败了。在 Eclipse 和 Netbeans 中,我使用 XML Catalog 配置了替代架构位置,因此它们可以验证 WSDL 文件而不会出现错误。然而,当他们从 wsdl 生成代码时,他们会失败。
Is there any tool for generating Java code from WSDL using XML Catalogs? The problem is that I have wsdl files that import XML schemas which also import other schemas and the schemas are not available at schemaLocation url. That is why code generation fails. If a tool was able to use XML Catalog this problem would be solved without modifying each schemaLocation in each WSDLs and schemas.
I have tried Eclipse and Netbeans plugins but both failed. In Eclipse and Netbeans I have configured alternative schema locations by using XML Catalog and so they can validate WSDL files without error. However, when they generate code from wsdl they fail.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
刚刚发现 JBoss 的 wsconsume 工具能够使用 XML 目录进行实体解析,并且工作正常。
http://community.jboss.org/wiki/JBossWS-wsconsume
Just found that JBoss's wsconsume tool is able to consume XML Catalogs for entity resolution and it works fine.
http://community.jboss.org/wiki/JBossWS-wsconsume
仅供记录:我在 Github 上建立了一个使用 XML 模式的小示例项目。它可能有任何帮助: https://github.com/fmarot/xml-mapping-tutorial< /a>
请务必检查其 wiki 以获得概述:https://github.com /fmarot/xml-mapping-tutorial/wiki
Just for the record: i've set up a small exemple project on Github that uses an XML schema. it may be of any help: https://github.com/fmarot/xml-mapping-tutorial
Be sure to check its wiki too in order to have an overview: https://github.com/fmarot/xml-mapping-tutorial/wiki
WSDL 必须在不使用 XML 目录的情况下有效,否则使用该 WSDL 的客户端将无法使用它。
当然,如果您永远不会使用任何不在 JBoss 平台上运行的客户端,那么您会没事的。
The WSDL has to be valid without the use of XML catalogs, or clients consuming that WSDL will not be able to consume it.
Of course, if you will never use any clients not running on the JBoss platform, then you'll be fine.
与此同时,我找到了另一种最适合我需求的解决方案。有一个名为 jaxws-maven-plugin 的 Maven 插件,它还能够在从 wsdl 生成源时处理 XMLCatalogs。
https://jax-ws-commons.dev.java.net /jaxws-maven-plugin/
Meanwhile, I found an other solution that fits the best to my needs. There is a maven plugin called jaxws-maven-plugin that is also able to handle XMLCatalogs when generating sources from wsdl.
https://jax-ws-commons.dev.java.net/jaxws-maven-plugin/