Dynamically Invoking Subprocesses Using SetEPR Activity

This sample illustrates the Dynamic Invocation of the Subprocess using Set EPR activity. The Set EPR activity generates the Endpoint Reference and determines the service to be invoked at runtime. In this sample, the Service Consumer and Service provider reside in different applications.

Setup

Import the sample project into the workspace. Ensure that both applications are in the workspace. For more information, see Accessing Samples.

Description of the Project

This sample comprises two applications. Service Provider (Provider.bwp) and Service Consumer (Consumer.bwp).

  • The Service Consumer invokes the service using Dynamic Process Reference, which is located in the Service Provider application.
  • Service Consumer has one process, Consumer.bwp. This process has the Dynamic Reference to the Service. The Consumer process contains a Sleep activity which ensures that consumer waits to invoke the service, till the service gets deployed and is ready to process the request.
  • Service Provider has one process, Provider.bwp. This process uses the Hello.wsdl file to implement the service and sends a response message to the incoming request.
Note: Every application requires at least one component to deploy the application. In this sample, the Activator.bwp process is used in the service provider application for the Provider.bwp to be deployed without configuring the binding.

The following image shows the configuration details of the Set EPR activity in the Consumer.bwp.



The following image shows the details of consumer using the Dynamic Process Reference as the Reference Type.

Procedure

  1. In the samples directory, select core > dynamic > processInvocation and double-click tibco.bw.sample.core.dynamic.processInvocation.ServiceConsumer.
  2. In Project Explorer, expand the tibco.bw.sample.core.dynamic.processInvocation.ServiceConsumer project.
  3. Set the default ApplicationProfile to match the OS you are running on. For more information, see Setting the Default Application Profile.
  4. Fully expand the Processes directory and click Consumer.bwp.
  5. Click Run > Debug Configurations.
  6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication
  7. Click the Applications tab and then click the Deselect All button if you have multiple applications. Select tibco.bw.sample.core.dynamic.processInvocation.ServiceConsumer and tibco.bw.sample.core.dynamic.processInvocation.ServiceProvider applications.
  8. Click Debug.
    This runs the sample in a Debug mode.
  9. Click the Terminate icon to stop the process.

Result

A output.log file is created with the content "Hello from the ServiceProvider".

Troubleshooting

If the service consumer starts before the service provider, then increase the value in the Sleep activity in the Consumer.bwp.