IBM BPM, V8.0.1, All platforms > Programming IBM BPM > Developing client applications for BPEL processes and tasks > Developing web services API client applications > Developing client applications in the Java web services environment

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

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 starting to create a client application, generate the web service proxy.

This topic applies to the following Business Process Choreographer web services interfaces:

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 );
    }  
  }   

Developing client applications in the Java web services environment


Related tasks:
Use the wsimport command-line tool to generate a web service proxy for a web services application
Generate a web service proxy (Java web services)