Creating web service proxy classes using wsdl2java / Apache CXF

I am trying to create a web service proxy using the wsdl2java tool that comes with Apache CXF. It seems that the generation is going very well, but there are some errors in the generated files, a non-existent constructor is called.

The file offers a solution:

//This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 //compliant code instead. 

So, I decided to download and install the 2.2 version of JAX-WS Api. I found the following installation guide explaining how to approve these new files: http://dcx.sybase.com/1200/en/dbprogramming/httpserver-jaxws-lesson-two.html I followed every step of this guide, deleted the old ones generated files and but new problems persist.

Any tips and / or tricks? (now, of course, I use the -frontend jaxws21 flag to generate a proxy, but still).

+8
java wsdl web-services proxy cxf
source share
1 answer
 <defaultOptions> <frontEnd>jaxws21</frontEnd> </defaultOptions> 

This is how I solved the problem using maven:

  <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>2.5.2</version> <executions> <execution> <id>generate-sources2</id> <configuration> <sourceRoot>${basedir}/target/generated-sources/cxf</sourceRoot> <defaultOptions> <frontEnd>jaxws21</frontEnd> </defaultOptions> <wsdlOptions> <wsdlOption> <wsdl>...</wsdl> </wsdlOption> </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin> 

EDIT: I found another way to solve this problem using maven and cxf version 2.7.3. Add these libraries to your dependencies. Now you do not need to use the jaxws21 option:

  <dependency> <groupId>javax.xml.ws</groupId> <artifactId>jaxws-api</artifactId> <version>2.2.9</version> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.2.7</version> </dependency> 
+6
source share

All Articles