cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kou, Zhi Qiang (JIRA)" <>
Subject [jira] [Created] (CXF-4918) Cannot get xsd schema file when access wsdl file as "?wsdl" with auto redirect turned on
Date Mon, 25 Mar 2013 08:19:14 GMT
Kou, Zhi Qiang created CXF-4918:

             Summary: Cannot get xsd schema file when access wsdl file as "?wsdl" with auto
redirect turned on
                 Key: CXF-4918
             Project: CXF
          Issue Type: Bug
          Components: Transports
    Affects Versions: 2.6.2
         Environment: Windows
            Reporter: Kou, Zhi Qiang

Problem Description:

The scenario is trying to access wsdl file from remote service provider using URL as "http://localhost:9083/TestWeb/HelloService?wsdl".
The remote service redirect the request to URL "http://localhost:9083/TestWeb/HelloService/HelloService.wsdl".

I turned on AutoRedirect by calling method "HTTPClientPolicy.setAutoRedirect(true)" in CXF.
The auto redirection works and WSDL file is loaded successfully.

However, inside of the WSDL file it imports another XSD schema file which is in the same folder
as WSDL file on remote server.

<xsd:import namespace="" schemaLocation="HelloService_schema1.xsd"/>

CXF tries to load this XSD file, but it use the original URL "http://localhost:9083/TestWeb/HelloService?wsdl"
as base URI, and got the wrong target address as "http://localhost:9083/TestWeb/HelloService_schema1.xsd".
Obviously it failed since the XSD file is not there.

Actually if CXF use the new URL after auto redirect as base URI, it will get the correct URL
for XSD file, in this case it should be "http://localhost:9083/TestWeb/HelloService/HelloService_schema1.xsd".


In method TransportURIResolver.resolve(String curUri, String baseUri):

                    InputStream ins = exch.get(InputStream.class);
                    InputSource src = new InputSource(ins);
                    lastestImportUri = base.toString();

The actual redirect happens in method HTTPConduit.redirectRetransmit(...) when "c.close(message)"
above is invoked. However TransportURIResolver has no idea if redirect happens or not. So
it still save the original URI (the variable base) to publicId and systemId and lastestImportUri.
Later when it tries to get XSD file these info will be used as base URI.

To resolve this problem I suggest we get the new URL after redirect, and save it as publicId,
systemId, or lastestImportUri. And use it as future base URI.

Per my investigation the new URL after redirect can be retrieved from message object:

           conn = ("http.connection");
                    String newURL = conn.getURL().toURI().toString();

The problem is at this place it does not know if redirect happened or not. If it does not
happen, the returned URL should be the same as original base URI.

Could somebody help to review this logic please? Is there any object for this proposed change?
Any suggestion are welcome. Thank you!


This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message