WebSphere Commerce provides an XML message mapper which can be used to map inbound XML messages to WebSphere Commerce command interfaces based on the inbound XML message template definition files.
Whenever an inbound XML message is passed to the message mapper, it checks to see if the message is defined in the template definition files. If so, it retrieves the WebSphere Commerce controller command name and parameter names for the message, and parses the incoming message to get the values for the parameters. Once the message has been parsed, the message mapper returns a CommandProperty object that contains the command name and the parameter name-value pairs for the command.
The message template definition files are used to define the XML parsing information for the inbound XML message. Each message defined in these files has the following two base elements:
- TemplateDocument: Defines the DTD file used by the message, the command that is called when the message is received, which tag mapping is to be used, and the XML element from which tag mapping is started.
- TemplateTag: Defines the mapping of XML elements in the DTD file to parameter names of commands in WebSphere Commerce. The template tag element identifies the parameter names and tells the message mapper where to find the values on an incoming message.
There are two template definition files provided by WebSphere Commerce. The sys_template.xml file is the template definition used to map existing WebSphere Commerce inbound XML messages. The user_template.xml is provided to enable you to add additional inbound XML messages. Both files are in XML format, based on the ec_template.dtd template definition DTD file. By default, all of the template definition, template definition DTD, and DTD files for inbound XML messages are stored in the following directory:
WC_installdir/CommerceServer/xml/messaging
WC_installdir/WebCommerce/xml/messaging
Important: For security reasons, you must ensure that only authorized persons can access and modify the sys_template.xml and the user_template.xml message template definition files. If unauthorized persons have access to write to this file, they would have the ability to write new inbound messages that could invoke any WebSphere Commerce command as a Site Administrator. For more information on security, see the WebSphere Commerce Security Guide.