This topic applies only to the IBM Business Automation Workflow Advanced
configuration.

Creating a client application for BPEL processes and human tasks (Java web services)

Draft comment:
This topic only applies to BAW, and is located in the BAW repository. Last updated on 2025-03-13 12:15
A client application sends requests to and receives responses from the Business Process Choreographer web services APIs. By using a web service proxy to manage communications and helper classes to format complex data types, a client application can invoke web service methods as if they were local functions.

Before you begin

Before starting to create a client application, generate the web service proxy.

About this task

Topic scope: This topic applies to the following Business Process Choreographer web services interfaces:
  • HTTP transport layer
  • JMS transport layer
You can develop client applications using any web services-compatible development tool, for example IBM® Rational® Application Developer. You can build any type of web services application to call the web services APIs.

Procedure

  1. Create a new client application project.
  2. Generate the web service proxy.
  3. Code your client application.
  4. Build the project.
  5. Run the client application.

Examples for the HTTP and JMS transport layers

The following examples show how to use the Business Flow Manager web service API for the supported transport layers. The examples differ in how the web service proxy is generated.

HTTP transport layer
The following example shows how to use the Business Flow Manager web service API for the HTTP transport layer.
 try {
    // create bfm proxy
    BFMJAXWSPortType bfm = new BFMJAXWSService().getBFMJAXWSPort();

    // call getProcessTemplate
    ProcessTemplateType ptt = 
      bfm.getProcessTemplate("MY_PROCESS_TEMPLATE_NAME");

    // handle return value
    System.out.println("Process template '" + ptt.getName() + 
        "' found, details following:");
    System.out.println("Execution mode: " + 
        ptt.getExecutionMode());
    System.out.println("Schema version: " + 
        ptt.getSchemaVersion());
  } catch (Exception e) {
    if ( e instanceof ProcessFaultMsg )
    {
      ProcessFaultMsg pfm = (ProcessFaultMsg) e;
      List<FaultStackType> list = 
          ( pfm.getFaultInfo() ).getFaultStack();
      FaultStackType fault = list.get( 0 );
      System.out.println( "ProcessFaultMessage: " + 
          fault.getMessage() );
    }
    else
    {
      e.printStackTrace( System.out );
    }  
  }   
JMS transport layer
The following example shows how to use the Business Flow Manager web service API for the JMS transport layer.
 try {
    // create bfm proxy
    BFMJAXWSPortType bfm = new BFMJMSService().getBFMJMSPort();

    // call getProcessTemplate
    ProcessTemplateType ptt = 
      bfm.getProcessTemplate("MY_PROCESS_TEMPLATE_NAME");

    // handle return value
    System.out.println("Process template '" + ptt.getName() + 
        "' found, details following:");
    System.out.println("Execution mode: " + 
        ptt.getExecutionMode());
    System.out.println("Schema version: " + 
        ptt.getSchemaVersion());
  } catch (Exception e) {
    if ( e instanceof ProcessFaultMsg )
    {
      ProcessFaultMsg pfm = (ProcessFaultMsg) e;
      List<FaultStackType> list = 
          ( pfm.getFaultInfo() ).getFaultStack();
      FaultStackType fault = list.get( 0 );
      System.out.println( "ProcessFaultMessage: " + 
          fault.getMessage() );
    }
    else
    {
      e.printStackTrace( System.out );
    }  
  }