0
votes

I am trying to create a Java stub from a WSDL file in the command prompt. This is my command to convert WSDL to a Java stub file:

WSDL2Java -Eosv -uri  MyfileName.wsdl.

But I am getting this exception and I don't know how to resolve it. Can anyone help me to find out, how to solve this error?

Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerationEngine.java:156) 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 (at /wsdl:definitions/wsdl:types/xsd:schema): faultCode=OTHER_ERROR: An error occurr ed trying to resolve schema referenced at 'http://www.example/Example_Service/Service.svc?xsd=xsd1', relative to ' file:/D:/axis2-1.4.1/bin/MyFileName.wsdl'.: java.net.ConnectException: Connection refused: connect at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) 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:288) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerationEngine.java:111) ... 2 more

1

1 Answers

0
votes

By looking at the exception, it searches for a file in below path.

D:/axis2-1.4.1/bin/MyFileName.wsdl

Make sure your file is in above location or put the http URL of wdsl file where the web service is hosted in your command.