Creating JSP files for displaying messages

Why and when to perform this task

Business Process Choreographer Explorer displays messages for various purposes. Some of these messages require more information to enhance their usability. You can create user-defined JavaServer Pages (JSP) files to display this additional information.

A user-defined JSP that displays messages and more information about these messages receives the message data with the help of the BusinessProcess session bean.

Steps for this task

  1. Make the BusinessProcess bean available to the JSP file.
    BusinessProcessService process = MessageUtilities.getBusinessProcessService(request);
    You can use the BusinessFlowManagerService interface to develop applications that work with both the remote and the local object of the bean.
  2. Receive the input or output messages of the process or activity using either the getInputMessage or the getOutputMessage method.

    When user-defined JSP files are called, they receive the ID of the object they are displaying. Call the getParameter method to receive the ID from the HttpServletRequest object. If the JSP file is related to an activity, the activity instance ID (AIID) comes as a string with the HttpServletRequest object. Similarly, JSP files that work with process instances receive the process instance ID (PIID) of the process as a string. You can use the following constants in the calls.

    Table 1. Constants that can be used in calls to JSP files
    Java name Usage
    com.ibm.bpe.portal.util.Constants.WF_AIID Used in user-defined JSPs for staff activities to access the activity instance ID. Use this ID to retrieve the corresponding com.ibm.bpe.api.ActivityInstanceData objects with the generic API.
    com.ibm.bpe.portal.util.Constants.WF_PIID Used in user-defined JSPs for receive, pick, or reply activities to access the process instance ID. Use this ID to retrieve the corresponding com.ibm.bpe.api.ProcessInstanceData object. This ID is not available in the following situations:
    • Before a process instance starts
    • For user-defined JSPs for the reply activity of a non-interruptible process
    com.ibm.bpe.portal.util.Constants.JSP_OUTPUT_ MESSAGE Used to retrieve the output message of a non-interruptible process in a user-defined JSP for a receive node.
    For example, you can receive the process output message of a process as an org.apache.wsif.base.WSIFMessage message in one of the following ways depending on the type of process:
    • For interruptible processes, the ID of the process is received using the getParameter method:
      // code for interruptible processes
      String piid = request.getParameter(Constants.WF_PIID);
      ClientObjectWrapper messageWrapper = (ClientObjectWrapper) process.getOutputMessage(piid);
      WSIFMessage message = (WSIFMessage) messageWrapper.getObject();
      
    • For non-interruptible processes the output message is put into the request:
      // code for BPEL-based non-interruptible processes
      ProcessResponseWrapper messageWrapper = 
         (ProcessResponseWrapper) request.getAttribute(Constants.JSP_OUTPUT_MESSAGE);
      WSIFMessage message = (WSIFMessage) messageWrapper.getObject();
      
      // code for V5.0-style non-interruptible processes
      ClientObjectWrapper messageWrapper = 
         (ClientObjectWrapper) request.getAttribute(Constants.JSP_OUTPUTMESSAGE);
      WSIFMessage message = (WSIFMessage) messageWrapper.getObject();

    For all types of processes, use the getObject method to receive the message object.

  3. Access the message parts.

    For example, a process output message might have the following structure:

    outputMessage java.lang.String
    flowID int

    You can access the parts as shown in the following code snippet:

    String outputMessage = (String)msg.getObjectPart("outputMessage");
    int flowID = msg.getIntPart("flowID");

Terms of use | | Broken links

Last updated: Tue Dec 06 04:14:42 2005

(c) Copyright IBM Corporation 2005.
This information center is powered by Eclipse technology (http://www.eclipse.org)