Generate Java classes from WSDL files using cxf-codegen-plugin in Maven

Last Updated on

This post demonstrates how to generate Java classes from WSDL files using cfx-codegen-plugin. This means we require Maven for this purpose.

Software Requirements

The following items were used for this post.

  • Java 8
  • Maven
  • IntelliJ IDEA 2017.2.6
  • cxf-xjc-runtime
    • See pom.xml

WSDL Source

We will use a WSDL file downloaded from the following URL


The web service may change anytime without us knowing it unless we consume the it. Therefore, we included the WSDL file in our Maven project.

Non-Standing SOAP 1.2 Binding

You may encounter the following issue with wsimport. It may still work with older version of SOAP. If possible, please use wsdl2java directly or via cxf-codegen-plugin.

We will only deal with SOAP 1.2 in this post.

Maven Plugin

The key configuration to achieve our end to update our pom.xml as follows.

We also need the following dependency.

When we do a clean install, we get the following generated classes along with the .jar file.

Check the Jar file

There is another plugin (in the same pom.xml) responsible in moving the generated compiled classes to our jar file.

Download the codes


Karl San Gabriel

Karl San Gabriel

Professional Software Developer