通过给定的 wsdl 文件自动生成 java 客户端代码的正确工具/方法是什么(文档文字包装样式)

发布于 2024-09-01 21:19:19 字数 161 浏览 1 评论 0原文

我尝试了 axis2 中的 wsdl2java 工具,但 XML Java 类绑定看起来有问题,因此在进行调用时,将抛出 ADBException(使用了 adb 绑定)。 有人可以告诉我从这种风格的 wsdl 文件(标准 .net 风格:文档文字包装)生成可以工作的客户端代码的赌注工具/方法吗? 谢谢。

I tried the tool wsdl2java from axis2, but looks something wrong with the XML Java class binding, so when making the call, a ADBException (adb binding used) will be thrown out.
can someone kindly tell the bet tool/way to generate can-work client code from such style of wsdl file (standard .net style:document literal wrapped)?
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

软甜啾 2024-09-08 21:19:19

如果您使用 1.6 版本的 JDK,则有一个名为 wsimport 的内置工具。这使用 JAXB 从 WSDL 创建和编译存根。我认为输出兼容遵循 JAX-wS 标准。

需要注意的一件事是,您可能需要自定义 JAXB 自定义绑定,以便所有数据类都具有实际值而不是 JAXBElement 实例。这是自定义绑定内容:

<jaxb:bindings version="2.0"
  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings> 

如果这对您不起作用,请查看 axis2 的 apache CXF (我认为您已经尝试过)。

祝你好运。

If you are using the 1.6 version of the JDK there is a built in tool called wsimport. This uses JAXB to create and compile the stubs out of the WSDL. The output is compatible follows the JAX-wS standard I think.

One thing to be careful about is that you may need a custom JAXB custom binding so that all your data classes have actual values and not JAXBElement instances. Here is the custom binding contents:

<jaxb:bindings version="2.0"
  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings> 

If that doesn't work out for you look into either apache CXF of axis2 (which i think you already tried).

Good luck.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文