Before you start:
To complete this task, you must
have completed the following tasks:
Also, before you begin this task you should note the following points:
- 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.
For information on adding files to your workspace, see Importing file systems into the workbench.
- 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. It is therefore recommended that
you enable namespace support before importing a schema. For further information
on enabling namespace support, see Creating a message set.
- 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. The XML schema is not modified to
remove namespaces. You can add the physical layer to the message set before
or after importing the XML schema but it is recommended that
you add the physical layer before importing
a schema. For information on adding an XML wire format, see Adding an XML wire format.
- 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. For further information on setting these preferences, see Configuring message set preferences.
Note that the extension to the 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.
- In the displayed list of workbench files, click the XML schema
file that you want to import then click Next. If you
opened the wizard as described in step 3 above, the *.xsd file
that you right-clicked is already selected when the next page appears.
- In the list of message sets shown under Message sets,
click the target message set for the message definition file that you are
creating. The Message definition file name field
is automatically filled in with a default file name based on the name of the
file you are importing. If required, you can change the name of the displayed
default file name to a new name of your choice.
- Optional: If you want to replace the contents of an existing message
definition file:
- Type the name of the existing file in the Message
definition file name field.
- Select the Overwrite the existing file contents without
warning check box. The existing file is overwritten
without a warning being displayed.
- Click Next. Your XML schema
is validated.
- Optional: In the displayed list of global elements, select the
check boxes for the global elements (based
on global complex types) from which you want to create messages. Use
the Select All and Deselect All buttons
to select all global elements in the list or no global elements in the list.
Tip: Only global elements based on global complex types are visible.
Any other global elements are not visible.
- Optional: If the target message set for the message definition
file you are creating does not have namespace support enabled, you have the
option of clicking Next. This presents you with a window
that allows you to add additional namespaces.
- Click Finish. The message
definition file is created from the XML schema and is opened in the Message
Definition editor.
- When you have completed the XML schema import using the wizard,
carefully check for any errors in the report that is created when the file
is imported. You can find this report in the log directory
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.
After importing XML schema files, review the messages
shown in the workbench task list to check
whether any new warnings or errors have appeared. Examples of situations where
messages appear are listed 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 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 Problems when developing message models for
further information.