Maciej Pietroń created CXF-4952:
-----------------------------------

             Summary: Initiating java web service client passing local WSDL 
file with relative path to XSD in schemaLocation
                 Key: CXF-4952
                 URL: https://issues.apache.org/jira/browse/CXF-4952
             Project: CXF
          Issue Type: Bug
            Reporter: Maciej Pietroń


I have WSDL and XSD files stored localy. Using CXF (wsdl2java tool) - I have 
generated client service classes. To service class constructor I pass local 
path to WSDL file like this:

MyService(MyService.class.getResource("my_wsdl_file.wsdl"), someQName)

And this part work fine - I mean path passing to service constructor is fine. 
Problem occurs while parsing the WSDL file. In WSDL file there is:

<xsd:schema xmlns:xsd="http://www.some_schema_address.org/XMLSchema";>
    <xsd:import namespace="http://www.some_schema_address.org/XMLnamespace";
                schemaLocation="my_xsd_file.xsd">
    </xsd:import>
</xsd:schema>

The my_xsd_file.xsd file is stored in the same location as my_wsdl_file.wsdl, 
but parser cannot find it. It appears that relative paths weren't being 
resolved relative to the current directory the WSDL was located in.

I am using WebSphere Application Server. Locations of WSDL and XSD files in the 
deployed application are:

C:\Program 
Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\myCellName\myApplicationName.ear\myWebserviceName.jar\org\some_package\my_wsdl_file.wsdl
C:\Program 
Files\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\myCellName\myApplicationName.ear\myWebserviceName.jar\org\some_package\my_wsdl_file.xsd

Parser searching XSD file in:

C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\my_wsdl_file.xsd

I was checking sources a bit (I didn't checked it thoroughly, so in this part I 
could be wrong), and it seems that class: 
com.ibm.wsdl.xml.WSDLReaderImpl take relative paths from class wsdlLocator that 
was passed to readWSDL method by 
org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(String url). 
There root is obtaining by wsdlLocator.getBaseInputSource() method, witch in 
fact return InputSource.getSystemId() instead of location on WSDL file.     

--
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: http://www.atlassian.com/software/jira

Reply via email to