Implementing a Service with a Service Binding and a Client with a Reference Binding

In this sample, a service implements a simplified online mortgage broker application. The borrower requests a loan through a broker. The broker processes the loan request using one of the third-party partner services. The borrower can either specify the preferred third-party provider or allow the broker to default to one. The third-party partner services request credit rating of the borrower from a credit check service and in turn approves or rejects the loan application based on the credit rating.

Procedure

  1. In the samples directory, select binding > soap > http > MortgageBrokerServiceClient and double-click tibco.bw.sample.binding.soap.http.MortgageBrokerServiceClient. For more information, see Accessing Samples.
  2. In Project Explorer, expand the tibco.bw.sample.binding.soap.http.MortgageBrokerServiceClient project.
  3. Set the default ApplicationProfile to match the OS you are running on. For more information, see Setting the Default Application Profile.
  4. You can modify the values specified for the Name, Amount, and Preferred bank fields by clicking on the Input tab of the Invoke activity Client in the borrower.LoanRequestProcess process.

  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 the check box next to tibco.bw.sample.binding.soap.http.MortgageBrokerServiceClient.application.
  8. Click Debug.
    This executes the sample in Debug mode.
  9. Click the Terminate icon to stop the process.

Result

The response is printed to the console and to disk in the output.log file. The response contents are either response from Mortgage Broker:Name: John: Status: REJECTED, or response from Mortgage Broker:Name: John : Status: APPROVED.

  • When a preferred bank is specified, the corresponding bank service is invoked. If not, Bank_A service is invoked.
  • When the Bank_A and Bank_C servives are invoked, either an Approved or Rejected message is returned, depending on the (random) credit score for the applicant.

Understanding the Configuration

This sample illustrates various features of the Process Reference. These features are present as options of Reference Type available on the General tab of the properties view of the Process Reference.



The available options are:

  • Binding Reference
  • Binding Reference - External
  • Process Reference
  • Process Reference - Dynamic

The following processes defined in this sample explain their features in the processes.

borrower.LoanRequestProcess

This process acts as a Consumer and allows the borrower to issue a loan request to the Mortgage Broker Service. The borrower specifies the values of the following fields in the requestLoanOperation activity in the borrower.LoanRequestProcess process.

  • Borrower name
  • Loan amount requested
  • Preferred bank. Specify one of the available banks "Bank_A" and "Bank_C". By default, the broker service calls bank A, if no preferred bank is specified.
    Note: Add an empty string "", for not specifying a preferred bank.


This process uses Process Reference option to invoke the Mortgage broker process. This options statically map the two Processes together.



mortgageBroker.LoanRequestProcess

This process receives the request from the borrower and calls the available SOAP Service Providers through subprocess calls.

Depending on the value of "Preferred bank" request field, this process either uses Process Reference -Dynamic option with Set EPR activity to dynamically call Bank_A_PartnerProcess or Bank_C_PartnerProcess sub process OR uses the Process Reference option to statically invoke the Default_PartnerProcess sub process.



Each subprocess uses the Binding Reference option on the Process Reference to act as a SOAP Service Consumer, of an available Bank Service.



banks.bank_A.Bank_A_Process

This process acts as both a SOAP Service Provider for the mortgage broker and a SOAP Service Consumer for the Credit Check Service.

Note: SOAP Service Provider configuration is specified at the Component level.


Bank_A_Process invokes the credit check service through "BankSubProcessForCreditCheck" sub process. This subprocess uses Binding Reference option, on the Process Reference, to act as a SOAP Service Consumer.

banks.bank_C.Bank_C_Process

This process receives the details of the borrower from the mortgage broker and queries a credit check services to validate the borrower credentials. The bank can specify the borrower name. The process exposes services to the mortgage broker.

This process acts as both a SOAP Service Provider for the mortgage broker and a SOAP Service Consumer for the Credit Check Service.

Note: SOAP Service Provider configuration is specified at the Component level.
Bank_C_Process uses Binding Reference-external option on the Process Reference, to act as a SOAP Service Consumer of the Credit check Service.
Note: Configuration of Binding Reference-external is specified at the Component Level.


creditCheck.CreditCheck

This process acts as a SOAP Service Provider for credit check functionality. It processes the request returns the credit rating for a customer.

Note: SOAP Service Provider is configured at the Component level.