1. Axis2
  2. AXIS2-4060

wsdl2java is unable to retrieve a WSDL when basic authentication is required


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4, 1.4.1
    • Fix Version/s: 1.7.0
    • Component/s: codegen
    • Labels:


      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:


      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:




      at Source)

      ... 6 more


        Jorge Medina created issue -
        Dimuthu Leelarathne made changes -
        Field Original Value New Value
        Assignee Dimuthu Leelarathne [ muthulee ]
        Mark Kinsella made changes -
        Comment [ I reproduced this error and tested it with a quick-and-dirty PHP page that logs all sent credentials -- indeed, there are no credentials at all being passed from wsdl2java to my page.

        I'm not sure I'm following the source correctly, but per my initial investigation, this looks like an issue with the associated wsdl4j-1.6.2 library, specifically the getContentAsInputStream(URL url) function in the class.

        I can't see that there is any credential passing going on here, nor any reading of credentials from the URL via url.getUserInfo() or anything similar.

        Not sure what might have changed here, as I can't find a copy of wsdl4j prior to a 1.6.2 release, and I'm not sure what libs axis2 was using in the functioning version. ]
        Samisa Abeysinghe made changes -
        Component/s codegen [ 12311413 ]
        Sagara Gunathunga made changes -
        Assignee Dimuthu Leelarathne [ muthulee ] Sagara Gunathunga [ sagara ]
        Sagara Gunathunga made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.7.0 [ 12316136 ]
        Resolution Fixed [ 1 ]


          • Assignee:
            Sagara Gunathunga
            Jorge Medina
          • Votes:
            6 Vote for this issue
            7 Start watching this issue


            • Created: