Hi everybody,
I am having a problem with javax.wsdl.xml.WSDLReader trying to parse a WSDL
URL with ?wsdl, when the URL is under HTTP Basic authentication.
What I am doing is the following:
WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
Definition def = reader.readWSDL(wsdlURL);
I am using Axis2 1.3 and wsdl4j-1.6.2.jar
Here is the stack trace I receive when I run my example code:
Retrieving document at '
http://localhost:8082/wsstack/services/httpbasicauth?wsdl'.
com.my.wsstack.client.api.WSClientException:
java.lang.reflect.InvocationTargetException
at com.my.wsstack.client.api.WSClientFactory.newInternalClient(
WSClientFactory.java:146)
at com.my.wsstack.client.api.WSClientFactory.newClient(
WSClientFactory.java:62)
at com.my.wsstack.samples.HttpBasicAuthClient.invokeWebService(
HttpBasicAuthClient.java:37)
at com.my.wsstack.samples.HttpBasicAuthClient.main(
HttpBasicAuthClient.java:28)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.my.wsstack.client.api.WSClientFactory.newInternalClient(
WSClientFactory.java:134)
... 3 more
Caused by: com.my.wsstack.client.api.WSClientException:
javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Unable to
resolve imported document at '
http://localhost:8082/wsstack/services/httpbasicauth?wsdl'.:
java.io.IOException: Server returned HTTP response code: 401 for URL:
http://localhost:8082/wsstack/services/httpbasicauth?wsdl
at com.my.wsstack.client.impl.WSBasicClientImpl.<init>(
WSBasicClientImpl.java:200)
at com.my.wsstack.client.impl.WSStaxClientImpl.<init>(
WSStaxClientImpl.java:35)
... 8 more
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR:
Unable to resolve imported document at '
http://localhost:8082/wsstack/services/httpbasicauth?wsdl'.:
java.io.IOException: Server returned HTTP response code: 401 for URL:
http://localhost:8082/wsstack/services/httpbasicauth?wsdl
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.my.wsstack.client.impl.WSBasicClientImpl.<init>(
WSBasicClientImpl.java:194)
... 9 more
Caused by: java.io.IOException: Server returned HTTP response code: 401 for
URL: http://localhost:8082/wsstack/services/httpbasicauth?wsdl
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(
HttpURLConnection.java:814)
at java.net.URL.openStream(URL.java:913)
at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
... 12 more
Thank you in advance!
Dobri