FileNotFound when CXF client calls JWSDP Web Service with relative schema import in JBoss EAP

Solution Verified - Updated -

Issue

  • We have a mix of JWSDP (JAX-RPC doc/lit) and CXF Web Services client/servers. One of the problems we have encountered is that when a CXF client calls a JWSDP service, if the server's WSDL contains XSD includes with relative paths such as ../, the path to those includes that is built from their relative path is built incorrectly and a FileNotFoundException is produced. The generated XSD file's path is computed from the local EAP deployment folder location rather than from the WSDL location on the remote machine.  See the exception below:

    javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
         at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:150)
         at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:65)
         at javax.xml.ws.Service.<init>(Service.java:56)
         at com.jboss.examples.ws.client.ExampleWSService.<init>(ExampleWSService.java:44)
         at com.jboss.examples.ws.client.TestClientHelper.getExampleWS(TestClientHelper.java:49)
         at com.jboss.examples.ws.client.TestClient.main(TestClient.java:598)
    Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
         at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:93)
         at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:205)
         at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:148)
         ... 8 more
    Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:types/xs:schema[1]): faultCode=PARSER_ERROR: Problem parsing '../SharedResources/Schemas/Common/putnam
    Headers.xsd'.: java.io.FileNotFoundException: C:\workspaces\migration\resources\schemas\common\headers.xsd (The system cannot find the path specified)
         at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2111)
         at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:808)
         at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:632)
         at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(WSDLReaderImpl.java:593)
         at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(WSDLReaderImpl.java:305)
         at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2265)
         at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2251)
         at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:230)
         at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:179)
         at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:91)
         ... 10 more
    Caused by: java.io.FileNotFoundException: C:\workspaces\migration\resources\schemas\common\headers.xsd (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(FileInputStream.java:106)
         at java.io.FileInputStream.<init>(FileInputStream.java:66)
         at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
         at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
         at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:653)
         at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:186)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:772)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
         at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
         at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
         at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2101)
         ... 19 more
    

The CXF client code looks like this:

    String endpointAddress = "http://testserver1:8080/examplews/ExampleWS?WSDL
    URL url = new URL(endpointAddress);
    ExampleWSService service = new ExampleWSService(url);
    ExampleWS port = service.getFastSvcWebServicePort();

Environment

  • JBoss Enterprise Application Platform (EAP) 5.1
  • Apache CXF Web Services Stack

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.