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 your 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 your 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:
- Initialization services
- Message content setting services
- Add e-mail parts or attachments services
- Configuration of transport services used for a message
- Sending services
- Other services
To create a new outbound message and use the composition service for the message:
- Create a new controller command or customize an existing task command to send a message with a certain message ID or name.
- 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 your company name.
- Create a new row with the name in WebSphere Commerce Struts framework and assign the devicefmt_id, and JSP page (with the full path).
- Create a profile in the PROFILE table using the WebSphere Commerce 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 (ie. 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) = -5Note: 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.
- Create a messaging system object using the SendMsgCmd task command. Use the setMsgType(String) and setStoreId(Integer) described in the topic Initialization services.
- Invoke the SendMsgCmd.execute() method.
(C) Copyright IBM Corporation 1996, 2006. All Rights Reserved.