Skip to main content

Development

TIBCO BW Plug-in – REST and JSON Usage

TIBCO provides support for REST and JSON plug-ins for the Business Works 5.x edition; these plugins can be installed after installing Business works 5.x edition manually. REST plug-ins can allow the user to invoke Restful web services and expose BW applications as Restful web services. JSON plugins will help to transform XML data to JSON and vice-versa.

The following are options that are available to use REST and JSON plugins in TIBCO BW 5.x:

JSON

Various properties of XML and JSON activity doesn’t assure to transform an XML into JSON completely because some properties cannot be transformed. For example, tags and attributes in XML under each element have no format in JSON.

For generating XML schema from JSON data, BW provides internal tool and below are the steps to use it.

  • Select Tools > JSON Tools> Generate XML Schema from JSON
  • Browse JSON data and select it in option

Xml Schema will present in folder called JSON_GEN_Schemas
We have two JSON palettes that can be used in any process created in a project. They are :

  • Parse JSON
  • Render JSON

Parse JSON

Parse JSON activity will pick up any JSON data transform them to XML structure.

Input Format: JSON

Output Format: XML

Render JSON

Render JSON activity will transform XML data into JSON string.

Input Format: XML

Output Format: JSON

Below is a sample project which uses JSON plugin:

REST

REST plugin invokes RESTful web services and exposes BW processes as RESTful web services. There are two palettes under REST plugin and they are as follows:

  • Invoke REST API
  • REST Dispatch and Reply

Invoke REST API

Invoke REST API palette connects to RESTful web services, and receives responses from web services so that BW activities can work on those responses. This palette also provides feature to use WADL file, which can be used to provide RESTful web service definitions.

If HTTP structure of WADL file does not match with web service don’t alter the HTTP structure instead edit WADL file and press RELOAD WADL button to reflect those changes.

Passing value in REST API

We have below options to send data through REST API

  • Template – only for WADL file option
  • Query
  • Header
  • Body – ( Form, Binary, Text and Multipart)

Screenshot of sample project which invokes RESTAPI call:

REST Dispatch and Reply

REST Dispatch and Reply palette provides ability to expose BW process as RESTful web services. Input request from HTTP request will be mapped to BW process and it will be processed. Upon arrival of input request this palette picks it up and passes value to process bound to it. Bound processes will perform necessary action and pass out from their activities to this palette which will be passed as HTTP response.

Service editor tab in this palette will help to bind BW process for incoming HTTP methods so it has to be configured for receiving any HTTP request.

Screenshot of sample project which exposes bw process as REST webservice:

Tags

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Dinesh Adhinarayanan

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram