简体   繁体   English

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

[英]what's the right tool/way to auto generate java client code by a given wsdl file (document literal wrapped style)

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

If you are using the 1.6 version of the JDK there is a built in tool called wsimport. 如果您使用的是1.6版的JDK,则有一个内置的工具叫做wsimport。 This uses JAXB to create and compile the stubs out of the WSDL. 这使用JAXB从WSDL中创建和编译存根。 The output is compatible follows the JAX-wS standard I think. 输出兼容我认为的JAX-wS标准。

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. 要注意的一件事是,您可能需要自定义JAXB自定义绑定,以便所有数据类都具有实际值而不是JAXBElement实例。 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). 如果这对您不起作用,请查看axis2的任一Apache CXF(我认为您已经尝试过)。

Good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM