SwitchYard XML validation does not work

Solution Verified - Updated -

Issue

  • I am using SwitchYard XML validator to check if file contents are correct or not.
  • However, even if I send an incorrect file (which does not satisfy the schema), it is getting processed.
  • The project configuration and source code are as follows:
  • switchyard.xml:
<sy:switchyard [...] name="validation_example" targetNamespace="urn:com.example.switchyard:validation_example:1.0">
  <sca:composite name="validation_example" targetNamespace="urn:com.example.switchyard:validation_example:1.0">
    <sca:service name="InboundFileService" promote="CamelServiceRoute/InboundFileService">
      <sca:interface.java interface="com.example.switchyard.validation_example.InboundFileService"/>
      <file:binding.file name="file1">
        [...]
      </file:binding.file>
    </sca:service>
    <sca:component name="CamelServiceRoute">
      <camel:implementation.camel>
        <camel:java class="com.example.switchyard.validation_example.CamelServiceRoute"/>
      </camel:implementation.camel>
      <sca:service name="InboundFileService">
        <sca:interface.java interface="com.example.switchyard.validation_example.InboundFileService"/>
      </sca:service>
      <sca:reference name="OutboundReference">
        <sca:interface.java interface="com.example.switchyard.validation_example.OutboundReference"/>
      </sca:reference>
    </sca:component>
    <sca:reference name="OutboundReference" multiplicity="0..1" promote="CamelServiceRoute/OutboundReference">
      <sca:interface.java interface="com.example.switchyard.validation_example.OutboundReference"/>
      <file:binding.file name="file1">
        [...]
      </file:binding.file>
    </sca:reference>
  </sca:composite>
  <sy:validates>
    <validate:validate.xml name="{urn:com.example.switchyard:validation_example:1.0}SampleSchema" schemaType="XML_SCHEMA" failOnWarning="true" namespaceAware="true">
      <validate:schemaFiles>
        <validate:entry file="xsd/SampleSchema.xsd"/>
      </validate:schemaFiles>
    </validate:validate.xml>
  </sy:validates>
</sy:switchyard>
  • Java interfaces for the service and reference:
public interface InboundFileService {
    public void fileIn(String message);
}

public interface OutboundReference {
        public String fileOut(String message);
}
  • XML schema file (xsd/SampleSchema.xsd):
<xsd:schema [...]
    targetNamespace="urn:com.example.switchyard:validation_example:1.0"
    xmlns:tns="urn:com.example.switchyard:validation_example:1.0">
    [...]

Environment

  • Red Hat JBoss Fuse Service Works (FSW)
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content