axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Kinsella (JIRA)" <>
Subject [jira] Commented: (AXIS2-4060) wsdl2java is unable to retrieve a WSDL when basic authentication is required
Date Tue, 14 Sep 2010 00:49:35 GMT


Mark Kinsella commented on AXIS2-4060:

I was able to reproduce (read: I struggled with) this error, so I tested it with a quick-and-dirty
PHP page to view what (if any) credentials were being passed. None were.

So, I looked into the source a bit to see what I could find.

I'm a little rusty on how is intended to work these days, but it seemed that
the root of this issue lies in the wsdl4j-1.6.2 library, used by axis2, as it doesn't appear
to subclass the Authenticator class anywhere. Specifically, the class
and its method getContentAsInputStream(URL url) doesn't seem to be sending any authentication
when it calls url.openStream()

I added an inner class within that class, and added one line to the getContentAsInputStream
and was able to get access to the WSDL file using my credentials.
Here's my inner class...

static class WSDLAuthenticator extends Authenticator {
        public PasswordAuthentication getPasswordAuthentication() {
            String[] userInfoParts = uri.getUserInfo().split(":");
            return (new PasswordAuthentication(userInfoParts[0], userInfoParts[1].toCharArray()));
and I added this line after the if (url == null) block, to point the URL object to the Authenticator
  Authenticator.setDefault(new WSDLAuthenticator());

Not sure what the protocol is for suggesting patches to the wsdl4j project , but I suppose
I'll cross my fingers that good karma will come my way if I try.
I believe the wsdl4j code is CPL'd.

Anyway, thought I'd post this in case anyone finds it useful, or wishes to critique my approach.

> wsdl2java is unable to retrieve a WSDL when basic authentication is required
> ----------------------------------------------------------------------------
>                 Key: AXIS2-4060
>                 URL:
>             Project: Axis2
>          Issue Type: Bug
>    Affects Versions: 1.4.1, 1.4
>            Reporter: Jorge Medina
>            Assignee: Dimuthu Leelarathne
> When access to the WSDL requires basic authentication, wsdl2java fails to send the credentials
in version 1.4.1
> while version 1.3 works fine.
> Using version 1.4.1: 
>    > wsdl2java -uri
-s -uw -u
> you will  get HTTP error 401 as shown below, while the same command works fine when using
version 1.3.
>  ------ ---- --- --- --- --- --- --- 
> Retrieving document at ''.
> Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException
> : Error parsing WSDL
>         at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(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 '
> 080/webservices/mywsdl.wsdl'.: Server retu
> rned HTTP response code: 401 for URL:
> m:8080/webservices/mywsdl.wsdl
>         at Source)
>         at Source)
>         at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile(
>         at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerat
>         ... 2 more
> Caused by: Server returned HTTP response code: 401 for URL:
> dWsdl.wsdl
>         at
>         at
>         at Source)
>         ... 6 more

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message