0 Replies Latest reply on Jun 11, 2012 8:55 AM by radomir.kadlec

    XSD processing not correct

    radomir.kadlec

      Hello,

      the XSD processing for imported XSD files is in Fuse ESB not correct, when the imported XSD uses different target namespace as the parent XSD.

       

      In this case appears warning in the log, that the imported namespace is not defined and the ServiceMix does not use the XSD schema for messages definition and/or validation.

       

      Example when nsB.xsd imports nsA.xsd

       

      The nsA.xsd defines my common data types in the namespace nsA.

      The nsB.xsd imports naA.xsd to define the document element in the namespace nsB.

      And the nsB.xsd is imported from a wsdl and used to define the message content.

       

      The log bellow shows a mixed schema, that contains elements from both schemas, but the schema is not correct, because the imported namespace nsA is no more defined.

       

      nsA.xsd:

      <xs:schema elementFormDefault="qualified"

      targetNamespace="http://nsA" xmlns="http://nsA"

      xmlns:xs="http://www.w3.org/2001/XMLSchema">

      <xs:simpleType name="Id">

      <xs:restriction base="xs:string" />

      </xs:simpleType>

      </xs:schema>

       

      nsB.xsd (imports nsA):

      <xs:schema elementFormDefault="qualified"

      xmlns="http://nsB" targetNamespace="http://nsB"

      xmlns:xs="http://www.w3.org/2001/XMLSchema"

      xmlns:nsA="http://nsA">

      <xs:import schemaLocation="nsA.xsd" namespace="http://nsA" />

      <xs:element name="Document">

      <xs:complexType>

      <xs:sequence>

      <xs:element name="DocumentId" type="nsA:Id" />

      </xs:sequence>

      </xs:complexType>

      </xs:element>

      </xs:schema>

       

      The nsB.xsd is then used to define the WSDL message.

      When the service is called, in the log appears such a warning and schema log:

       

          • log BEGIN ***

       

      15:59:39,961 | WARN  | 6-114 - /xrg-int | EndpointReferenceUtils           |  -  -  | SAXException for newSchema()

      org.xml.sax.SAXParseException: src-resolve.4.2: Error resolving component 'nsA:Id'. It was detected that 'nsA:Id' is in namespace 'http://nsA', but components from this namespace are not referenceable from schema document 'bundle://418.17:1/wsdl/nsB.xsd'. If this is the incorrect namespace, perhaps the prefix of 'nsA:Id' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'bundle://418.17:1/wsdl/nsB.xsd'.

      at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)[:]

      at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)[:]

      at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]

      at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]

      at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source)[:]

      at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source)[:]

      at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown Source)[:]

      at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseSimpleContent(Unknown Source)[:]

      at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(Unknown Source)[:]

      at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseGlobal(Unknown Source)[:]

      at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(Unknown Source)[:]

      at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)[:]

      at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)[:]

      at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)[:]

      at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)[:]

      at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)[:]

      at org.apache.cxf.wsdl.EndpointReferenceUtils.createSchema(EndpointReferenceUtils.java:695)133:org.apache.cxf.bundle:2.4.3.fuse-01-02

      ...

       

      15:59:39,974 | INFO  | 6-114 - | EndpointReferenceUtils           |  -  -  | Schema for: http://nsB

      <?xml version="1.0" encoding="utf-8"?>

      <xs:schema

      xmlns:xs="http://www.w3.org/2001/XMLSchema"

      xmlns="http://nsB"

      xmlns:nsA="http://nsA"

      elementFormDefault="qualified"

      targetNamespace="http://nsB">

       

      <xs:element name="Document">

      <xs:complexType>

      <xs:sequence>

      <xs:element name="DocumentId" type="nsA:Id" />

      </xs:sequence>

      </xs:complexType>

      </xs:element>

       

      <xs:simpleType name="Id">

      <xs:restriction base="xs:string" />

      </xs:simpleType>

       

      </xs:schema>

       

            • log END ***

       

      I thing, the schemas are defined correct. I can use them in other tools such a SoapUI.

      But the Fuse ESB uses them in an incorrect way.

      I use apache-servicemix-4.4.1-fuse-06-03 in osgi deployment.

       

      What can I do with it?

      It seems to be a bug  in Fuse ESB.

       

      Thank you,

      Radomir

       

      Edited by: kadlec on Jun 11, 2012 12:50 PM

       

      Edited by: kadlec on Jun 11, 2012 12:54 PM