Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 7 Managing RESTful Web Services : Exposing BusinessWorks Processes as RESTful Web Services

Exposing BusinessWorks Processes as RESTful Web Services
After creating a RESTful web service, you can bind HTTP requests to TIBCO ActiveMatrix BusinessWorks processes to expose TIBCO ActiveMatrix BusinessWorks processes as RESTful web services.
Binding HTTP Requests to BusinessWorks Processes
To bind HTTP requests to TIBCO ActiveMatrix BusinessWorks processes, complete the following steps:
1.
Note: One method can only bind one process.
Figure 8 Select a Method
2.
In the right panel, click Browse resources next to the Process Name field. The Select a Resource dialog is displayed.
3.
In the Select a Resource dialog, select the process that you want to bind to and click OK.
After selecting the process, you can click Go to reference resource next to the Process Name field to direct to the bound process, where you can view and change the configurations of the bound process.
If you want to remove the bound process, click Clear reference to clear your current selection.
4.
In the right panel, click Bind. The Process Binding dialog is displayed.
5.
In the Process Binding dialog, configure the input and output mappings, and then click Bind to save your configurations. See Configuring the Input and Output Binding for details.
Configuring the Input and Output Binding
You can use the Process Binding dialog to specify how the HTTP request and response are mapped to the bound process.
Input Binding  You can use it to map parameters of the HTTP request to the input of the bound process.
The source data can be HTTP requests, Global Variables, Process Context, or other activities in this project.
Output Binding  You can use it to map the output of the bound process to the HTTP response as a reply. Two tabs are available in the Output Binding panel.
Binding  You can use it to define how the output of the bound process is mapped to the HTTP response.
The source data of the output can be the output of the bound process, Global Variables and Process Context in this project.
ResponseHeaders  You can use it to customize the HTTP response headers.
TIBCO ActiveMatrix BusinessWorksTM Plug-in for REST and JSON supports:
Customizing response code. See Customizing Response Code for details about how to customize response codes.
Downloading multiple part contents in one request from a TIBCO ActiveMatrix BusinessWorks process. See Downloading MIME Multiple Parts Messages for details about how to download multiple part messages in one request from a TIBCO ActiveMatrix BusinessWorks process.
Customizing Response Code
TIBCO ActiveMatrix BusinessWorksTM Plug-in for REST and JSON supports the following default respond codes:
Additionally, the plug-in also supports customizing the 200, 400, and 500 response codes.
To customize the response codes, complete the following steps:
1.
2.
In the Activity Input panel, expand RESTResponse > Headers.
3.
Right-click StatusLine, and then select Statement > Surround with choice.
4.
In the Choice dialog, specify the number of the when conditions, and whether you need the otherwise conditions, and then click OK.
5.
Enter values in the When, Otherwise and StatusLine nodes accordingly as shown in Figure 9.
Figure 9 Customize the Response
Downloading MIME Multiple Parts Messages
You can download multiple part messages in one request from a TIBCO ActiveMatrix BusinessWorks process which is exposed as a RESTful Web Service.
Prerequisites
Before downloading multiple parts of messages in one request from the server side, you need to enable the handleAllMimePartsAsAttachment property in the designer.tra file:
1.
Navigate to the TIBCO_HOME\designer\version_number\bin directory.
2.
Open the designer.tra file, and enter the following parameters in one line:
bw.plugin.http.handleAllMimePartsAsAttachment=true
3.
Download Multiple Parts
Configure the mimeEnvelopeElement item in the Activity Input panel of the Output Binding window to download multiple parts of the messages.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved