Find your content:

Search form

You are here

How to Convert wsdl to java classes using apache axis


Help me out to generate java classes from enterprise wsdl.

I followed this link:

I installed apache axis and placed wsdl file in the bin\ directory of AXIS. downloaded few jars and placed in lib/ and SET the environment variables like JAVA_HOME, PATH and CLASSPATH

CLASSPATH:C:\Program Files\Java\jdk1.7.0_09\lib;C:\Program Files\Java\jdk1.7.0_09\jre\bin;D:\axis2-1.6.2-bin;D:\axis2-1.6.2-bin\axis2-1.6.2\lib\wsdl4j-1.6.2;D:\axis2-1.6.2-bin\axis2-1.6.2\lib\mail-1.4;D:\axis2-1.6.2-bin\axis2-1.6.2\lib\activation-1.1;D:\axis2-1.6.2-bin\axis2-1.6.2\lib\log4j-1.2.15;D:\axis2-1.6.2-bin\axis2-1.6.2\lib\axis2-ant-plugin-1.6.2;D:\axis2-1.6.2-bin\axis2-1.6.2\lib\saaj;D:\axis2-1.6.2-bin\axis2-1.6.2\lib\commons-discovery;D:\axis2-1.6.2-bin\axis2-1.6.2\lib\jaxrpc



When I run in command prompt:

D:\axis2-1.6.2-bin\axis2-1.6.2\bin> wsdl2java.bat -uri D:\axis2-1.6.2-bin\axis2-1.6.2\bin\enterprise.wsdl

I got below error,I didnt find any new folder with java classes in src/ folder.

Using AXIS2_HOME: D:\axis2-1.6.2-bin\axis2-1.6.2 Using JAVA_HOME: C:\Program Files\Java\jdk1.7.0_09 Retrieving document at 'D:\axis2-1.6.2-bin\axis2-1.6.2\bin\enterprise.wsdl'. Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException : Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat at org.apache.axis2.wsdl.WSDL2Code.main( at org.apache.axis2.wsdl.WSDL2Java.main( Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Unabl e to resolve imported document at 'D:\axis2-1.6.2-bin\axis2-1.6.2\bin\enterprise .wsdl'.: This file was not found: file:/D:/axis2- 1.6.2-bin/axis2-1.6.2/bin/enterprise.wsdl at Source) at Source) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ... 2 more Caused by: This file was not found: file:/D:/axis 2-1.6.2-bin/axis2-1.6.2/bin/enterprise.wsdl at Source) ... 6 more

Attribution to: kavin

Possible Suggestion/Solution #1

As stupid as it sounds - have you made any typos in the filename?

I didn't specify full path and it works like charm for me:

c:\(my user)\axis\bin>wsdl2java -uri enterprise.xml

Using AXIS2_HOME:   c:\(my user)\axis
Using JAVA_HOME:    C:\Program Files\Java\jre7
Retrieving document at 'enterprise.xml'.
log4j:WARN No appenders could be found for logger (org.apache.axis2.description.
log4j:WARN Please initialize the log4j system properly.

But the moment I'll specify incorrect file name (say enterprise.wsdl in my case) it throws same error as yours...

Attribution to: eyescream

Possible Suggestion/Solution #2

Well the easiest way to do the same is using Java EE eclipse Ide.

  1. Create a Java Project
  2. Include the WSDL file in the project
  3. Right Click >> Webservices >> Generate Client

Attribution to: Avidev9
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content