2

Help me out to generate java classes from enterprise wsdl.

I followed this link: http://www.gerd-riesselmann.net/scala/creating-java-classes-wsdl-file-using-apache-axis-2

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

AXISLIB:%AXIS_HOME%\lib

AXISCLASSPATH:%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery.jar;%AXIS_LIB%\commons-logging-1.1.1.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;%AXIS_LIB%\log4j-1.2.15.jar;%AXIS_LIB%\xml-apis.jar;%AXIS_LIB%\xercesImpl.jar

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 ionEngine.java:178) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) 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'.: java.io.FileNotFoundException: This file was not found: file:/D:/axis2- 1.6.2-bin/axis2-1.6.2/bin/enterprise.wsdl at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( CodeGenerationEngine.java:320) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:133) ... 2 more Caused by: java.io.FileNotFoundException: This file was not found: file:/D:/axis 2-1.6.2-bin/axis2-1.6.2/bin/enterprise.wsdl at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source) ... 6 more

  • You're executing from the bin directory, you don't need to specify a location, just use -uri enterprise.wsdl . Also do you need to specify the output dir ? or does it default to something. – techtrekker Nov 27 '12 at 10:04
  • 1
    Just curious, is there any reason why you are not using the excellent Salesforce WSC library, code.google.com/p/sfdc-wsc? It has all this prebuilt for you and some added features. It also does not require Axis runtime. – Andrew Fawcett Nov 27 '12 at 10:09
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
| improve this answer | |
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.
WSDL11ToAllAxisServicesBuilder).
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...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.