Adding Java Callout Actions

Use the Java callout action to invoke a Java method, or EJB business service, from within the message flow.

Before you begin

These instructions assume you are already editing a message flow in the Edit Message Flow page, as explained in Creating, Editing, and Viewing Message Flows.

To add a Java Callout action

  1. Navigate to where you want to add the action, as described in Adding and Editing Actions in Message Flows.
  2. Click the appropriate icon, then select Add an Action > Message Processing > Java Callout.
  3. Click <Method>. The Select a JAR page is displayed. Select a JAR resource from the list. The Select a Class and Method page is displayed.
  4. From the list of Java classes listed, click the + beside the appropriate class, to display a list of methods. Select a method and click Submit. The Java callout action is displayed on the Edit Stage page, as follows:
    • <Method> is replaced by the name of the Java method you selected in steps 2 and 3. This name is a link to the Select a Class and Method page. You can click this link to change your selection of Java method.
    • The method must be a static method.

    • Parameters: An <Expression> link to the XQuery Expression Editor page is provided for each argument the Java method requires. A label for each link indicates the data type for the argument, which will be one of the following:
      • Java.lang.String
      • Primitive types, and their corresponding class types (e.g., int vs. java.lang.Integer)
      • java.lang.BigDecimal, and java.lang.BigInteger (these types are used in financial calculations where round-off errors or overflows are not tolerable)
      • only org.apache.xbeans.XmlObject and no typed xml beans.
      • byte[]
      • java.lang.String[] (INPUT ONLY)
      • XmlObject [ ] (INPUT ONLY)
    • Result: A Result field in which you enter the variable to which the result is to be assigned. The label for the field indicates the data type of the result.
    • Note: If the result is a byte array (the only possible array returned), the binary-content XML element is returned.
    • Attach a Service Account: A Service Account link allows you to specify an optional Service Account if there is a security context for this Java method. To learn more about security contexts and service accounts, see Service Accounts.
    • In the case of fixed and mapped service accounts, the userid/password from the service account is authenticated in the local system and the security context propagated to the Java callout. In the case of passthru, the security context is propagated to the Java callout. This context is the message level context if defined (with WS-Security). Else it is the transport level context.

  5. Under Parameters, click <Expression>. The XQuery Expression Editor page is displayed. Use the XQuery Expression Editor to provide the arguments required by the Java method. See Creating and Editing Inline XQuery and XPath Expressions
  6. If the type of the input value you enter does not match the declared input argument type, ALSB tries to automatically typecast input values to the declared type of the input argument. For example a string value of "123" will be converted to integer 123 if the declared type of the input argument is java primitive int.

  7. In the Result field, assign a variable for the result returned by the Java method.
  8. If there is a security context for the Java method, select the check box and click <Service Account>. The Select Service Account page is displayed. Select the required service account from the list, and click Submit.

After you finish

When you complete the configuration of this action, continue by configuring other actions or by saving your configuration, as described in Adding and Editing Actions in Message Flows.