Adding messages to the Listener for WebSphere MQ

WebSphere Commerce allows you to extend the Listener for WebSphere MQ (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:

  1. Create a DTD file to be used for parsing the inbound message and put it in WC_installdir/xml/messaging directory.
  2. Add it to the tag of Messaging attribute, ECInboundMessageDtdFiles, in the WebSphere Commerce configuration file:
    <Messaging 
    EcInboundMessageDtdFiles="NCCommon.mod, NCCustomer_10.mod, 
    Create_NC_Customer_10.dtd, Update_NC_Customer_10.dtd, Update_NC_OrderStatus_10.dtd, 
    Update_NC_ProductInventory_10.dtd, Update_NC_ProductPrice_10.dtd, Create_WCS_Customer_20.dtd, 
    Update_WCS_Customer_20.dtd, Update_WCS_OrderStatus_20.dtd, Update_WCS_ProductPrice_20.dtd, 
    Inquire_WCS_PickPackListDetail_10.dtd, Create_WCS_PickBatch_10.dtd, Create_WCS_ExpectedInventoryRecord_10.dtd, 
    Create_WCS_InventoryReceipt_10.dtd, Update_WCS_InventoryReceipt_10.dtd, Create_WCS_ShipmentConfirmation_10.dtd, 
    Update_WCS_ProductInventory_20.dtd, Request_WCS_BE_ProductInventory_10.dtd, Update_WCS_OrderStatus_30.dtd, 
    Update_WCS_PriceAndAvailability_10.dtd, Update_WCS_ShoppingCartTransfer_10.dtd, Update_WCS_BatchAvailability_10.dtd"
    EcInboundMessageDtdPath="E:\WebSphere\CommerceServer56\xml\messaging"
    EcMimePropFile="lang_mime.data"
    EcSystemTemplateFile="sys_template.xml"
    EcTemplatePath="E:\WebSphere\CommerceServer56\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 the WebSphere Commerce Server.

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>

Feedback