Defining XML Messages for RA JMS Agent Sender Jobs

When setting definitions for RA JMS Agent Sender Jobs, if you select XML from the Message Type field, you can define the message from an XML file or by inputting XML code.

Browsing to a File

To select a file, select File and click its browse icon to browse to a message file or enter a directory and file name in.

The File field can include object variables in the format &<variable name>. The values of these object variables will be replaced at runtime.

Inputting Data

To enter text, select Direct Input and enter text in the text box.

  • The XML is displayed with colored syntax highlighting.
  • Some auto-complete is available.
  • Some code validation is done.
  • Line numbers are displayed on the left side of the Direct Input text box and code blocks are collapsible/expandable.

You can have the RA JMS Agent auto-format your text to add logical line breaks and indentations for better readability by clicking Pretty Print.

This text box can include object variables in the format &<variable name>. The values of these object variables will be replaced at runtime.

Validating the XML Code

You can validate XML code to assure that:

  • Its schema is valid.
  • The syntax of the XML is well formed.

If object variables are used, the validation will fail in the definition, because & is not a valid XML character.

You can validate the XML code in the Direct Input text box by clicking the Validate icon while viewing the Job definition.

You can validate the payload each time the Job runs by checking the Validate Payload at Runtime box. If the validation does not pass for a run of the Job, it will abort. A sample error message from an aborted Job is shown below.

com.uc4.ra.common.RaException: Warning: schema_reference.4: Failed to read schema document 'Employee.xsd', because

1) could not find the document;

2) the document could not be read;

3) the root element of the document is not <xsd:schema>.

The way the XML validates depends on your Job definition.

To have the JMS Agent validate: Do the following:
A schema in an external file (this is the most common and preferred best-practice method)

Click the Schema File field's browse icon to browse to a message file or enter a directory and file name in.

You can add XML from the schema to the Direct Input box by clicking the XML icon.

A schema location specified within the XML document

In the file selected in the Schema File field or the text in the Direct Input text box, specify a schema with the attributes noNamespaceSchemaLocation or schemaLocation to point to the file location of the schema. For example: 

 xsi:noNamespaceSchemaLocation="/schemas/catalog.xsd"

If the location is not formatted correctly, the RA JMS Agent looks for the schema in the Agent's bin directory.

With no schema defined

Leave the Schema File field empty and do not specify a schema in the Direct Input box.

When no schema is defined, the RA JMS Agent only does a syntax check; checking if the XML is well-formed. Since there is no schema to validate against, no schema validation is performed.

When the schema definition is embedded in the XML document, the RA JMS Agent only does a syntax check; checking if the XML is well-formed. In this case, no schema validation is performed.