cxf-issues mailing list archives

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


Kou, Zhi Qiang commented on CXF-4918:

Hi Daniel, thank you so much for giving the fix of this issue!
> Cannot get xsd schema file when access wsdl file as "?wsdl" with auto redirect turned
> ----------------------------------------------------------------------------------------
>                 Key: CXF-4918
>                 URL:
>             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:schema>
> <xsd:import namespace="" schemaLocation="HelloService_schema1.xsd"/>
> </xsd:schema>
> 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".
> =============
> Investigation
> =============
> In method TransportURIResolver.resolve(String curUri, String baseUri):
>                     c.prepare(message);
>                     c.close(message);
>                     InputStream ins = exch.get(InputStream.class);
>                     resourceOpened.addElement(ins);
>                     InputSource src = new InputSource(ins);
>                     src.setPublicId(base.toString());
>                     src.setSystemId(base.toString());
>                     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!
> Regards,
> Eric

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