Adding messages to the WebSphere MQ Listener

WebSphere Commerce allows you to extend the WebSphere MQ Listener (formally transport adapter) to process additional messages. This involves doing the following:

To do this, you will need to have an advanced knowledge of XML, and of the WebSphere Commerce controller commands. If your message requires you to create a new controller command, you will also need to have an advanced knowledge of the WebSphere Commerce database schema, and Java programming.

To add messages, do the following:

  1. Create a DTD file to be used for parsing the inbound message and put it in WC_installdir/xml/messaging.
  2. Add it to the tag of Messaging attribute, ECInboundMessageDtdFiles, in the INSTANCE_name.xml file:
    EcInboundMessageDtdPath="E:\WebSphere\CommerceServer55\xml\messaging"
    EcMimePropFile="lang_mime.data"
    EcSystemTemplateFile="sys_template.xml"
    EcTemplatePath="E:\WebSphere\CommerceServer55\xml\messaging"
    EcUserTemplateFile="user_template.xml"
    XMLWebControllerUserId="wcsadmin" 
    />
    
  3. Create a mapping file to map the message content to the command name and needed parameters in the user message template file. The initial template can be found at WC_installdir/xml/messaging/user_template.xml.
  4. To add new messages, continue with the following: 

    • Create a new controller command (interface and implementation) to execute the needed business logic.
    • Add a row into the URLREG table  and assign a URL name with  a proper interface name.
  5. If you are overriding existing command implementation, add or update the corresponding row in  the CMDREG table,  and assign a proper class name mapping to the correct interface name.
  6. Restart WebSphere Commerce.

The following are samples you can follow:

Sample message:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Update_New_Message SYSTEM 'Update_New_Message.dtd'>
<Update_First_Element version='1.0'>
<DataArea>
<ABC>123456</ABC>
</DataArea>
</Update_First_Element>

Sample DTD file:

<!ELEMENT Update_First_Element (DataArea)>
<!ATTLIST Update_First_Element
  version CDATA #FIXED "1.0">
<!ELEMENT DataArea (ABC)>
<!ELEMENT ABC (#PCDATA)>

Sample user_template.xml:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE ECTemplate SYSTEM 'ec_template.dtd' >
<ECTemplate>
<TemplateDocument>
<DocumentType version='1.0'>Update_New_Message</DocumentType>
<StartElement>Update_First_Element</StartElement>
<TemplateTagName>NewMessageMap</TemplateTagName>
<CommandMapping>
<Command CommandName='NewCommand' />
</CommandMapping>
</TemplateDocument>
<TemplateTag name='NewMessageMap'>
<Tag XPath='DataArea/ABC' Field='ABC_id' />
</TemplateTag>
</ECTemplate>