Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-5532

jax-ws-catalog.xml / @SchemaValidation / xsd-includes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.7
    • 2.7.10
    • JAX-WS Runtime
    • None
    • JBOSS EAP 6.1.1

    • Unknown

    Description

      When using catalog resolving (jax-ws-catalog.xml) in combination with @SchemaValidation and a set of xsd files (that include each other) the wrong file is coupled with the wrong stream in org.apache.cxf.wsdl.EndpointReferenceUtils. It concerns method SchemaLSResourceResolver#resolveResource.

      Observation:
      1) The resolver is constructed with a correct set of entries (Schemas).
      2) The resolver then tries to match on (ending of) systemId:targetNameSpace (that fails)
      3) The resolver then tries to match on (ending of) targetNamespace only. All entries on the same namespace match, so the first one (arbitrary) is resolved.

      I've prepared a patch on this class that fixes the issue. Test projects are available.

      @Line210 I've included the following code:
                  // Sjaak PATCH
                  // there can be multiple includes on the same namespace. This scenario is not envisioned yet.
                  // hence the filename part is included as well. 
                  if (systemId != null) {
                      String systemIdFileName = systemId.substring(systemId.lastIndexOf('/') + 1);
                      for (Map.Entry<String, byte[]> ent : schemas.entrySet()) {
                          System.out.println("matching: " + ent.getKey() + " endswith: " + systemIdFileName + ":" + namespaceURI);
                          if (ent.getKey().endsWith(systemIdFileName + ":" + namespaceURI)) {
                              schemas.remove(ent.getKey());
                              impl = new LSInputImpl();
                              impl.setSystemId(newId);
                              impl.setBaseURI(newId);
                              impl.setCharacterStream(
                                      new InputStreamReader(
                                              new ByteArrayInputStream(ent.getValue())));
                              done.add(newId + ":" + namespaceURI);
                              System.out.println("match!, adding to done: " + ent.getKey() + "returning: " + impl.getSystemId());
                              return impl;
                          }
                      }
                  }
                  // sjaak END PATCH.
      

      The patch introduces a step 2a to the steps above:

      2a) The resolver then tries to match on (ending of) systemIdFileName:targetNameSpace (that fails)

      Best regards,
      Sjaak

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            sjaakd sjaak derksen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: