Adding message mappers
To add a new message mapper, you must manually add it to the group of message mappers in the HCL Commerce configuration file.
Procedure
- Open the HCL Commerce configuration file.
- Locate MessageMapperGroup element.
- Define your 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="my-component-services-system-template.xml" EcUserTemplateFile="my-component-services-user-template.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
- An integer from -100 to -9999. It must be unique in the
MessageMapperGroup
. - classname
- The name of the class implementing the
MesssageMapper
interface. For example, com.ibm.commerce.messaging.programadapter.messagemapper.ecsax.ECSAXMessageMapper.
Notes:- If you do not define
EcSystemTemplateFile
andEcUserTemplateFile
in<MessageMapper>
, the default message values are used. The default values -EcSystemTemplateFile
andEcUserTemplateFile
- are located in the HCL Commerce configuration file<Messaging>
element. IfEcSystemTemplateFile
,EcUserTemplateFile
, or both are defined, the default<Messaging>
values are not used. - If
EcInboundMessageDtdPath
andEcInboundMessageDtdFiles
are not specified in<MessageMapper>
, the default values are used. The default values are located in the HCL Commerce configuration file<Messaging>
element. IfEcInboundMessageDtdPath
,EcInboundMessageDtdFiles
, or both are defined, the default<Messaging>
values are not used. - If
EcSystemTemplateFile
orEcUserTemplateFile
contains an empty value (for exampleEcSystemTemplateFile=""
) a NullPointerException is thrown. - For the WCS.INTEGRATION mapper, the isValidating
parameter is set to "true" by default, and
ParserFeatureList=
"http://apache.org/xml/features/nonvalidating/load-external-dtd=false,http://xml.org/sax/features/external-general-entities=false,http://xml.org/sax/features/external-parameter-entities=false"
. This configuration prevents the XML parser from parsing external general entities and external parameter entities.
- Within the
<configuration>
element, add any additional configuration attributes that the message mapper needs. This is converted into a TypedProperty object and passes to the init method of the message mapper.Note: In order to have your 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 Configuring the Program Adapter.