Develop > Controller layer > Integrate with back-end systems and external applications > Outbound services


Create an outbound message

In addition to the supported XML and WebSphere Commerce outbound messages, you can add support for new outbound messages. To add a new outbound message, write a new controller command to build the content of the new outbound message and send the message to the back-end system using the send services of the outbound messaging system.

There are two methods for building the content of new outbound messages. The first method is to build the new outbound message in your own String buffer and assign it to the outbound messaging system through the use of its message content setting services that set the message content directly. This alternative requires you to include the logic of building the message in the controller command that you write. The second method is to build the new outbound message through the use of the outbound messaging system composition services. Through the use of JSP pages, the composition services generates an outbound message according to the message layout and content you defined in the JSP page.

Outbound messaging system interface

Interactions with the outbound messaging system can be done through the SendMsgCmd task command. This task command externalizes all available interfaces to methods provided by the messaging system to set necessary parameters to construct and use the messaging system object. The following is a list of all available services in the SendMsgCmd command interface:


Procedure

  1. Create a new controller command or customize an existing task command to send a message with a certain message ID or name.

  2. Add a row into MSGTYPES table assign a msgtype_id with a new viewname, based on the command. Use a message type ID number above 1000. Prepend the viewname and message type name with the company name.

  3. Create a new row with the name in WebSphere Commerce Struts framework and assign the devicefmt_id, and JSP page (with the full path).

  4. Create a profile in the PROFILE table using the Administration Console, and assign the message type to the correct transport (for example, e-mail) and device format (for example, standard device format). See Assign a message type to a transport method for a site or store. A valid device format ID, as specified in the Struts configuration file, must be specified for each transport to be used. This device format ID (for example, DEVICEFMT_ID) must match with the one added into Struts configuration files in order to be able to pick the right JSP template file for composition. The following are the values you should use in the Struts configuration file:

    SOAP XML data transmitted via HTTP = -1
    HTTP Browser = Reserved for IBM 
    Standard Device Format = -3
    WebSphere MQ Adapter for XML = -4
    WebSphere MQ Adapter for WCS (Legacy message) = -5
    

    Most predefined message types (regardless for which transport they were designed) are designed to use the standard device format. What choice to pick is strictly dependent on how the entries for the Struts configuration file are created. The default values of device format ID may change in future releases.

  5. Create a messaging system object using the SendMsgCmd task command. Use the setMsgType(String) and setStoreId(Integer) described in the topic Initialization services.

  6. Invoke the SendMsgCmd.execute() method.


Related concepts

WebSphere Commerce Struts framework

Outbound messaging system

Related reference

Error handling in the messaging system composition service

Example: Using the messaging system composition service


+

Search Tips   |   Advanced Search