This describes how to create a new message definition from an XML
Schema using the New Message Definition File wizard in the workbench.
Before you start:
To complete this task, you must
have completed the following tasks:
Before you begin this task, you should be aware of the points listed
below:
- To create a new message definition file from an XML schema, the schema
file must already be present in the workbench,
for example in your message set project. This allows you to select the schema
file in the New Message Definition File wizard.
- If the message set to which you are adding the new message definition
file does have an XML wire format layer, but no namespace support, the imported schema is modified
to remove namespaces. For this reason, you should enable namespace support
before importing a schema.
- If the message set to which you are adding the new message definition
file does not have an XML wire format layer,
but does have namespace support, only the
logical information appears in the model. For this reason, you should add
the physical layer to the message set prior to importing the schema. This
will ensure that it is populated with the settings and values from the schema.
The XML schema is not modified to remove namespaces.
- If the message set to which you are adding the new message definition
file does not have an XML wire format layer,
and does not have namespace support, only
the logical information appears in the model and the imported schema is modified
to remove namespaces.
- If you are working with a message set that does not have namespace support,
you must specify the preferences that apply when you import a schema into
the message set. These preferences allow you to specify how the importer treats
certain individual schema constructs. You can either reject the schema if
any occurrences of the construct are encountered or modify occurrences of
the construct. If you choose modify, the importer modifies all occurrences
of the construct.
- The extension to the XML Schema file must be .xsd in
lower case.
The following steps cover creating a completely new message definition
file and also overwriting the contents of an existing file.
To create
a message definition from an XML schema file:
- Switch to the Broker Application Development
perspective.
- Open the New Message Definition File wizard
by clicking File > New > Message Definition File on
the workbench menu. Alternatively,
you can open the wizard by right-clicking an *.xsd file
previously imported into the workbench and
clicking New > Message Definition File on the menu.
- In the displayed list of options, click XML schema file to
select it then click Next.
- Step through the remainder of the wizard filling
in the details as required. The processing time for importing
the XML schema will vary depending on the size and complexity of that schema.
In a large and complex schema, it can take some time to import the file, generate
the log file and display any task list warnings or errors.
When you have completed importing the XML Schema using the wizard:
- Carefully check the log file for any warnings or errors in the report
that is created when the file is imported. These give information in relation
to whether the schema failed to import or needed to be modified to enable
it to be successfully imported. You can find this report in the log directory
structure within the project containing the message definition that you have
attempted to create. The report has a .xsd.report.txt file
extension, prefixed with the name that you specified for the new message definition
file.
- Review the messages shown in the workbench task
list to check whether any new warnings or errors have appeared. While you
could have imported a perfectly valid schema, the task list will display any
warnings or errors that exist in the message definition file. Some examples
of situations where messages appear are given below:
- If the XML schema that you are importing contains xsd:key, xsd:keyref
and xsd:unique constructs, warning messages appear in the task list to tell
you that these constructs are unsupported and will be ignored by the broker.
If you prefer to delete these constructs, open the message definition file
in the Message Definition editor, and delete the constructs as described in Deleting objects. Deleting the constructs also removes
the warning messages from the task list. If you decide not to delete the constructs,
they will remain in the message model but will not be deployed to the broker,
or be used for any other purpose. The warning messages in the task list will
remain, but you will be able to use the message model normally.
- If the XML schema that you are importing contains
xsd:redefine constructs, error messages appear in task list to tell you that
this construct is unsupported. If you right-click on the error messages and
select Quick Fix you can choose to convert the xsd:redefine
constructs into xsd:include constructs. This also removes the error messages.
- If you are importing a collection of related XML schema files and the
Message Definition Editor is unable to resolve the links between two of the
imported files, messages appear in the task list to say that referenced types
or other objects cannot be found. If this occurs, refer to Resolving problems when developing message models for
further information.