Question

I have a wsdl stored in a place which protected with HTTP BasicAuth. I try to read the wsdl from that as mentioned below[1]; But im getting following error

"faultCode=OTHER_ERROR: Unable to resolve imported document"

The full error stack is here[2]. Anyone know how can i read a wsdl from the secured place using wsdl4j?

[1]

           WSDLReader reader = getWsdlFactoryInstance().newWSDLReader();
        // switch off the verbose mode
        reader.setFeature(JAVAX_WSDL_VERBOSE_MODE, false);
        reader.setFeature("javax.wsdl.importDocuments", false);
        wsdlDefinition = reader.readWSDL(baseURI);

[2]

 at java.lang.Thread.run(Thread.java:662)

Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://10.100.1.35:9763/registry/re
source/_system/governance/apimgt/wsdls/admin--aa1.0.0.wsdl'.: java.io.IOException: Server returned HTTP response code: 401 for URL: http://10.100.1.35
:9763/registry/resource/_system/governance/apimgt/wsdls/admin--aa1.0.0.wsdl
        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2259)
        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2207)

        at java.lang.Thread.run(Thread.java:662)
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://10.100.1.35:9763/registry/re
source/_system/governance/apimgt/wsdls/admin--aa1.0.0.wsdl'.: java.io.IOException: Server returned HTTP response code: 401 for URL: http://10.100.1.35
:9763/registry/resource/_system/governance/apimgt/wsdls/admin--aa1.0.0.wsdl
        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2259)
        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2207)

No correct solution

OTHER TIPS

    String name = "admin";
    String password = "admin";

    String authString = name + ":" + password;
    System.out.println("auth string: " + authString);
    byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
    //byte[] authEncBytes= BASE64Encoder.encode(authString.getBytes();

    String authStringEnc = new String(authEncBytes);
    System.out.println("Base64 encoded auth string: " + authStringEnc);

    URL url = new URL(webPage);
    URLConnection urlConnection = url.openConnection();
    urlConnection.setRequestProperty("Authorization", "Basic " + authStringEnc);

add your code after this for reading wsdl. If basic authentication is used for that wsdl then it should work.

webpage is url of the wsdl.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top