![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |
The Invoke_partner_rest project describes how to use the REST Dispatch and Reply activity to expose TIBCO ActiveMatrix BusinessWorks processes as RESTful web services and how to use the Invoke REST API activity to invoke the exposed RESTful web services.This project implements a complete workflow of asking for a loan from a bank through the mortgage broker as shown in Figure 19.Here, a lender wants to ask for a loan from Bank C. The lender sends his request to the local broker. After receiving the loan request, the broker sends the loan request to Bank C that the lender prefers and Bank C invokes the CreditCheck service to check whether the lender is qualified for the loan.Figure 19 Workflow of a Loan RequestFour process folders are included in the Invoke_partner_rest project:
• Borrow This folder contains one process, LoanRequestProcess, which is used by the lender to initiates a loan request.See LoanRequestProcess (in the Borrow Folder) for more details.
• MortgageBroker This folder contains a PartnerProcesses process folder and a LoanRequestProcess process for the broker to handle the request from the lender.
− The LoanRequestProcess process is used for the broker to send the request to the corresponding bank according to the request from the lender.See LoanRequestProcess (in the MortgageBroker Folder) for more details.
− The PartnerProcesses folder contains the partners of the broker. That is, banks that are available for the banker to invoke. The bank process in this folder invokes the corresponding bank service when a request is received.See PartnerProcess(in the MortgageBroker Folder) for more details.
•
• CreditCheck This folder contains one shared resource and three processes. See Credit Check for more details.The LoanRequestRrocess process in the Borrow folder as shown in Figure 20, sends the loan request by invoking a local process.Figure 20 The Lender Initiates a Loan RequestThe LoanRequestProcess in the MortgageBroker folder as shown in Figure 21, sends the loan request to the corresponding bank based on the information provided by the lender.
• If the lender has a preferred bank, the CallPreferredBankProcess is run.
• If the lender has no preferred bank, the CallDefaultBankProcess is run.Figure 21 Sending the Request to the BankThe loan request is sent to the corresponding Bank process in the PartnerProcess folder. Here, the lender chooses Bank_C, so the loan request is sent to Bank_C. As Figure 22 shows, Bank_C invokes its bank service to handle the loan request.Take the Bank_C folder as an example. As shown in Figure 23, one shared resource and three processes are included in the Bank_C process folder.Figure 23 Bank_C Process Folder
• The Bank_C_HTTP_Connection shared resource is used to receive the incoming HTTP request.
• Figure 24 The Bank_C_Process
• Figure 25 Bank_C_Serviceshows how the HTTP request and response are mapped to the input and output of the bound Bank_C_Process process.Figure 26 Bank_C_Service
• Figure 27 Invoking the CreditCheck ServiceFigure 28 Credit Check Folder
• The CreditCheckHTTPConnection shared resource is used to receive incoming HTTP request.
• The CreditCheckProcess process is exposed as a RESTful service. When the request of checking credit is received, it checks the credit of the account provided by the bank and sends the check result (approved or rejected) to the bank.
• Figure 29 CreditCheck ServiceFigure 30 shows how the HTTP request and response are mapped to the input and output of the bound CreditCheck service process.Figure 30 Credit Check Service Mapping
2. Click Open Existing Project in the TIBCO Designer startup panel. The Open Project dialog is displayed.
3. Click Browse next to the Project Directory field, and then select the Invoke_partner_rest folder, which is located in the RESTJSON_HOME\examples directory. Click OK. The Invoke_partner_rest project is displayed.
4. Select InvokePartnerREST > Borrow > LoanRequestProcess in the Project panel.
6. Select Project > Save from the TIBCO Designer menu to save the project.After setting up the project, the next step is to trigger the processes in the InvokePartnerREST project:
1. In the Project panel, click the Tester tab, and then click Start testing viewed processat the top left corner in this panel. The Select Processes To Load dialog is displayed.
2.
3. Click the Borrow/LoanRequestProcess.process in the right panel, and then clickto start running the process.
4.
See TIBCO ActiveMatrix BusinessWorksTM Process Design Guide for detailed information on using the test mode including setting breakpoints and the element colors in the test mode.Figure 32 Returned Response
![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |