简体   繁体   中英

Generating Java Code from WSDL

I have to generate Java code from a wsdl file. Currently my project uses wsimport, but the wsdl file for which I have to generate code has RPC encoding. wsimport has no support for RPC. I tried using axis but it fails with following error:

soap:fault element not recognized for soap 1.2 binding

I found a jira already for this issue: https://issues.apache.org/jira/browse/AXIS-2614

axis2 doesn't support RPC. Is there any other way I can generate the code from the wsdl using maven.

You could try using JAX-RPC instead of axis

http://docs.oracle.com/javaee/1.3/tutorial/doc/IntroWS5.html

You can also use Axis1 framework. It is old, but available on https://axis.apache.org/axis There you can find a tool called wsdl2Java, which you can execute like:

java -cp <all jars of the framework> \
org.apache.axis.wsdl.WSDL2Java \
-p <destination package name> \
-o <destination src path> \
http://[Servername]/MyService?wsdl

This generates all classes from the wsdl service description file. Then you can use the Stub classes to access the service.

The last snapshot version you can find on https://builds.apache.org/job/axis-trunk Click on "Last Build" and then on "Distribution" (or Maven Plugin).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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