I am supposed to consume a SOAP service exposed by a third party. I have 2 basic questions w.r.t that:
Q1. The WSDL needs a basic authentication to access through the browser. Now when I try creating the client jar using wsgen/WSDL2JAVA/
using Eclipse Webservice
client, I get HTTP 401 unauthorised
. If I download and save the WSDL locally and then use axis's WSDL2JAVA
, I get
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.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=PARSER_ERROR: Problem parsing 'file:/C:/TEST/TOOLS/Authentication.wsdl'.: org.xml.sax.SAXParseException: The prefix "wsdl" for element "wsdl:definitions" is not bound.
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(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:320)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:133)
... 2 more
Caused by: org.xml.sax.SAXParseException: The prefix "wsdl" for element "wsdl:definitions" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
... 7 more
Q2. How do we handle a frequently changing WSDL, do we generate the client jars everytime and redeploy the application?
Any pointers in helping me create the client.jar
would be great.