WSDLFlattenner / SchemaCollection do not handle nested schemas inclusions 
properly
----------------------------------------------------------------------------------

                 Key: SM-1011
                 URL: https://issues.apache.org/activemq/browse/SM-1011
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-common
    Affects Versions: incubation
         Environment: Windows XP
            Reporter: Konrad Argasinski
             Fix For: incubation
         Attachments: nested schemas.txt

WSDLFlattener fails to analyse JSR-181 SU WSDL which imports multi-level 
(nested) schemas structure.

My JSR-181 SU WSDL imports A1.xsd schema. A1.xsd includes B1.xsd, B2.xsd and 
B3.xsd. B1.xsd includes C1.xsd.
The schema is used by JAXB during the project build and it works ok, however 
when the SU gets deployed on ServiceMix I receive following error:

<loc-message>NOT_FOUND_ERR: An attempt is made to reference a node in a context 
where it does not exist.</loc-message>
<stack-trace><![CDATA[org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is 
made to reference a node in a context where it does not exist.
        at org.apache.xerces.dom.ParentNode.internalRemoveChild(Unknown Source)
        at org.apache.xerces.dom.ParentNode.removeChild(Unknown Source)
        at 
org.apache.servicemix.common.tools.wsdl.SchemaCollection.handleImports(SchemaCollection.java:150)
The full stack trace is attached.

As workaround I compiled my custom SchemaCollection and it works ok now, 
however I think a better fix is needed.
My custom changes in org.apache.servicemix.common.tools.wsdl.SchemaCollection 
are:
around line 149 I have replaced:
                String location = ce.getAttribute("schemaLocation");
                schema.getRoot().removeChild(ce);
with:
                String location = ce.getAttribute("schemaLocation");
                Node parentNode = ce.getParentNode();
                Element root = schema.getRoot();
                if (root == parentNode) {
                   log.debug("Removing child include node: " + ce);
                   schema.getRoot().removeChild(ce);
                } else {
                   log.warn("Skipping child include node removal: " + ce);
                }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to