How to build WSDL using Maven

I want to replace the supplied Ant construct with Maven. I know (but did not use) Ant run, and I would prefer not too.

In short, NetSuite provides wsdl for use when invoking web services against its ERP clause, and I am currently using their provided Ant construct to create proxy classes from wsdl. (sample applications, wsdl and fixed axis are available here )

The problem is that the Ant task uses the fixed axis 1.4 (and supporting libraries, some of which are ~ 7 years old), and I would like to implement this wsdl using libraries that are easily accessible from the central maven repo and, preferably, current .

Can someone point me where I need to research a solution that will work?

For everyone who needs to know: I tried to generate using axis2, and this throws the following exception:

timeException: Element QName is null for ExceededRequestSizeFault! at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:293) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) Caused by: org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: Element QName is null for ExceededRequestSizeFault! at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitSkeleton(AxisServiceBasedMultiLanguageEmitter.java:1451) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:275) ... 2 more Caused by: java.lang.RuntimeException: Element QName is null for ExceededRequestSizeFault! at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getFaultParamElements(AxisServiceBasedMultiLanguageEmitter.java: 2925) at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getFaultElement(AxisServiceBasedMultiLanguageEmitter.java:2844) at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.generateMethodElement(AxisServiceBasedMultiLanguageEmitter.java: 2366) at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.loadOperations(AxisServiceBasedMultiLanguageEmitter.java:2242) at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.createDOMDocumentForSkeleton(AxisServiceBasedMultiLanguageEmitte r.java:2156) at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.writeSkeleton(AxisServiceBasedMultiLanguageEmitter.java:2082) at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitSkeleton(AxisServiceBasedMultiLanguageEmitter.java:1408) ... 3 more 

Bonus points if it is a proven solution with the recent NetSuite WSDL.

+6
source share
1 answer

I suggest you cxf maven plugin . I did a little test with this wsdl and successfully generated and compiled the source files (JVM 1.7) 1408. (be patient, it takes some time ...)

I get only a few warnings about the maximum listing size. And so I had to transfer the binding file to allow large enumerations. I did this through a binding file. Thanks to this post

Here is the required bind.xml file

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

And the corresponding part of pom.xml (as you can see: wsdl and bind.xml are in /src/main/resources )

 <build> <plugins> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>2.7.3</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <configuration> <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot> <wsdlOptions> <wsdlOption> <bindingFiles> <bindingFile>${basedir}/src/main/resources/bind.xml</bindingFile> </bindingFiles> <wsdl> ${basedir}/src/main/resources/netsuite.wsdl </wsdl> </wsdlOption> </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin> </plugins> </build> 
+12
source

All Articles