Software Development

Maven – Build Web Service client from WSDL file

Using wsimport on the command prompt allows you to generate a client jar, .java, and or .class files depending on the options you pass to it. To use it in Maven, you need to following stuff in your pom.xml

There are things worth noting.

Target path of generated java file

This is for build-helper-maven-plugin and is referred to the location where the artifacts are created from the WSDL file.

Config for jaxws-maven-plugin

Now this is for jaxws-maven-plugin.

Since we are using a WSDL file, we need to define the <wsdlDirectory> option to refer to the path where the WSDLs are. The <packageName> is a way to organize the generated codes into their own package. <sourceDestDir> is similar to the one we defined for build-helper-maven-plugin.

To build the maven project, use the wsimport goal.

For instance,

Loading

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like