About the XMLNSC Validation sample
The XMLNSC Validation sample demonstrates how WebSphere Message
Broker's XMLNSC parser can validate XML messages against a schema.
Message flow
The processing in the sample consists of one message flow called XMLNSCVALIDATIONMF1. The following figure
shows the XMLNSCVALIDATIONMF1 message flow:

The XMLNSCVALIDATIONMF1 message flow is in the Message Broker project called XMLNSCVALIDATIONMF. The message
flow performs the following tasks:
- Takes an XML message in through an MQInput node from the WebSphere MQ queue XMLNSCVALIDATIONMF1.IN.
- The MQInput node has the following properties defined on the:
Input Message Parsing tab:
- Message domain is set to XMLNSC.
- Message set is set to XMLNSCVALIDATIONMS.
Parser Options tab:
- Parse Timing is set to Complete.
- Build tree using XML schema data types is selected.
Validation tab:
- Validation is set to Content and Value.
- Failure action is set to Exception.
- The Out terminal of the MQInput node is wired to a Compute node called
ProcessValidMessage. The Compute node is associated with ESQL that copies InputRoot to OutputRoot.
- The Out terminal of the Compute node is wired to an MQOutput node
called OutputOK. The MQOutput node puts messages to queue XMLNSCVALIDATIONMF1.OUT.
- The Catch and Failure terminals of the
MQInput node are wired to a second Compute node called ProcessExceptionList. This Compute node copies the
relevant part of the ExceptionList to OutputRoot.
- The Out terminal of this Compute node is wired to an MQOutput node
called OutputFailure. This MQOutput node puts messages to queue XMLNSCVALIDATIONMF1.FAIL.
Message set
Message set XMLNSCVALIDATIONMS specifies runtime domain XMLNSC
and contains an XML schema called SampleMessageValidation.xsd. A message definition
file has been created from this schema. The message set contains the following:
- One message called SaleListMessage. The SaleListMessage is based on the message that is used in many of
the other samples.
- Several constraints have been added to the XML schema for this message to demonstrate various types of
validation failure. These constraints are:
- Value constraints:
- Surname has maxLength set to 20.
- Currency has valid values 'GBP', 'Sterling', 'USD', 'EUR',
'Euros' and 'JPY'.
- Quantity has minInclusive 1 and maxInclusive 100.
- Code has a pattern of 2 alphanumeric characters.
- Changed elements and attributes:
- An optional attribute 'Title' to Header.
- A mandatory attribute 'occurrence' to SaleList.
- An optional attribute 'guaranteed' to SaleList.
- A mandatory attribute 'isLast' to Trailer.
Broker archive file
The Message Broker project XMLNSCVALIDATIONMF contains the broker archive file for the sample, called
XMLNSCVALIATION.BAR. The Message Broker project also contains the test messages
used in the sample.
Test messages
The following test messages are used in this sample:
- ValidMessage.xml
- MissingElement.xml
- NamespacedMessage.xml
- NumericOutOfRange.xml
- PatternMismatch.xml
- StringInNumeric.xml
- StringTooLong.xml
- ValueNotInList.xml
For more details of the messages, and the expected results from the sample, see
Running the XMLNSC Validation sample.
Back to sample home