WSDL2Java Batch File

The other day I posted about the WSDL2Java utility. Well, here is the code for a Windows batch file which will set up the proper classpath to run the Axis WSDL2Java utility.

@echo off

SET TMPCLASSPATH=%CLASSPATH%

SET CFROOT=C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\lib\

SET CLASSPATH=.

SET CLASSPATH=%CLASSPATH%;%CFROOT%axis.jar

SET CLASSPATH=%CLASSPATH%;%CFROOT%jaxrpc.jar

SET CLASSPATH=%CLASSPATH%;%CFROOT%saaj.jar

SET CLASSPATH=%CLASSPATH%;%CFROOT%commons-logging-1.0.2.jar

SET CLASSPATH=%CLASSPATH%;%CFROOT%commons-discovery-0.2.jar

SET CLASSPATH=%CLASSPATH%;%CFROOT%wsdl4j- 1.5.1.jar

SET CLASSPATH=%CLASSPATH%;%CFROOT%xercesImpl.jar

SET CLASSPATH=%CLASSPATH%;%CFROOT%log4j.jar

cls

java org.apache.axis.wsdl.WSDL2Java -v -o %1 %2

SET CLASSPATH=%TMPCLASSPATH%

To use just pass in an output directory and the WSDL URL.

WSDL2Java C:\output http://www.somesite.com/service.asmx?wsdl

It is based on one I saw here. You may need to change the CFROOT variable depending on your ColdFusion installation.

Update

Adobe has a couple of TechNotes on this subject with specific instructions for various CFMX versions and installations:

Related Blog Entries

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.