Develop > Controller layer > Integrate with back-end systems and external applications > Inbound services > Message mappers
Add message mappers
To add a new message mapper, manually add it to the group of message mappers in the WebSphere Commerce configuration file.
Procedure
- Open the WebSphere Commerce configuration file.
- Locate MessageMapperGroup element.
To define the message mapper, add a MessageMapper element as a child element to the MessageMapperGroup element.
<component compClassName="com.ibm.commerce.programadapter.messagemapper.MessageMapperGroup" enable="true" name="MessageMapperGroup"> <property display="false"> <MessageMapper messageMapperId="new mapper id" classname="class implementing MessageMapper interface" enable="true" name="Name of Message Mapper"> <configuration EcSystemTemplateFile="mapping.xml" EcInboundMessageDtdFiles="something.dtd" EcTemplatePath="some_dir" EcSaxParserClass="org.apache.xerces.parsers.SAXParser" EcInboundMessageDtdPath="some_dir" isValidating="false" DebugMode="FALSE" EmptyElementClearsData="FALSE"/> </MessageMapper>
Where:
- messageMapperId
- The messageMapperId may be any whole number from -100 to -9999. It must be unique in the MessageMapperGroup.
- classname
- The name of the class implementing the MesssageMapper interface, com.ibm.commerce.messaging.programadapter.messagemapper.ecsax.ECSAXMessageMapper, for example.
Note that if both EcSystemTemplateFile and EcUserTemplateFile are not specified in the MessageMapper configuration above, we will use the default EcSystemTemplateFile, EcUserTemplateFile from the "Messaging" tag in the WebSphere Commerce configuration file. If either one or both were defined, both default values will not be used.
If both EcInboundMessageDtdPath and EcInboundMessageDtdFiles are not specified in the MessageMapper configuration above, the default values from the "Messaging" tag in the WebSphere Commerce configuration file will be used. If either one or both were defined, both default values will not be used.
Within the configuration element add any extra configuration attributes needed for the message mapper. This is converted into a TypedProperty object and passes to the init method of the message mapper. Note: In order to have the message mappers function properly, ensure that you are using the newer implementation class name of the XML parser, EcSaxParserClass="org.apache.xerces.parsers.SAXParser".
- Add this message mapper name to the list of message mapper names in the "supportedMessageMappers" attribute of the configuration element of the target program adapter, as is described in Configure the Program Adapter.
Related concepts
WebSphere Commerce configuration file
Related tasks