Tuesday, January 12, 2010

Generating Java code from a WSDL

Another java/web services post for yah. I recently had to generate some java code from a wsdl file to be able to access a webservice.

I used the axis2-wsdl2code-maven-plugin to accomplish this. Here's the pom file I created.



4.0.0
jalki-wsdl2java
jalki-wsdl2java
1.0-SNAPSHOT
jalki-wsdl2java



http://HOST:PORTS/CONTEXT/WEB_SERVICE_NAME?wsdl





org.apache.axis2
axis2
1.4


org.apache.ws.commons.axiom
axiom-impl
1.2.8


wsdl4j
wsdl4j
1.6.2





org.apache.axis2
axis2-wsdl2code-maven-plugin
1.4



wsdl2code


blah.blah.ws.client
${WSDL_FILE_LOCATION}











With a simple invocation of "mvn clean install" this great plugin generates the client Java classes needed to interact with the web service.