TIBCO Calling JSON-WS with Basic Authentication and SSL

Software

TIBCO Designer 5.8.0.10

Requirement

Call JSON-WS with HTTP Basic authentication and SSL

Protocol: https, oauth2

Request Method: POST

Parameters: grant_type, scope

Response Type: JSON format

Response Parameters: token_type, access_toke, expires_in, scope

Solution 1 : Using “Send HTTP Request”

Step 1: Select “Send HTTP Request” element.

Step 2: Configuration tab→Add Parameter: grant_type=string:Optional→scope=string:Optional→HTTP Authentication: BASIC→identity: (Create an “Identity” element→Type:Username/Password→Username: xxx→Password: xxx)→Check SSL→Configure SSL→Trusted Certificates Folder: select the folder containing certificates files (Create a folder→Tools→Trusted Certificates→Import into PEM format: select the .crt file→Check Strong Cipher Suites Only→OK).

Step 3: Input tab→Host: x.x.x.x→Method: ‘POST’→RequestURI: ‘/x/oauth/x…’→Headers: Accept-Encoding: ”, Content-Type: ‘application/x-www-form-urlencoded’→Parameters: grant_type=’client_credentials’, scope=’xxx’.

Step 4: Select “Parse JSON” element (Need REST and JSON plugin)→Configuration tab→Schema Type: XSD→Check Validate Output→Input tab→Map “Send HTTP Request” output “asciiContent” with “Parse JSON” input “jsonString”→Output Editor tab→Add a complex element with token_type, access_toke, expires_in, and scope elements.

Done.

Solution 2 : Using “Invoke REST API” (Need REST and JSON plugin)

Step 1: Add a Global Variables “BW_GLOBAL_TRUSTED_CA_STORE” and point to an external folder containing CA certificates using a file URL format (file:///).

Step 2: Select “Invoke REST API” element.

Step 3: Configuration tab→Method: POST→Response Type: JSON→Check Trust HTTPS Host→Authentication: Basic Authentication→Username: xxx Password: xxx.

Step 4: Input Editor tab→Add grant_type, scope elements to Body-Form.

Step 5: Input tab→URI: https://x.x.x.x/x/oauth/x… →Body-Form-grant_type: ‘client_credentials’, scope: ‘xxx’.

Step 6: Select “Parse JSON” element→Configuration tab→Schema Type: XSD→Check Validate Output→Input tab→Map “Invoke REST API” output “msg” with “Parse JSON” input “jsonString”→Output Editor tab→Add a complex element with token_type, access_toke, expires_in, and scope elements.

Done.

How to get the .crt file?

Open firefox→Menu→選項(Options)→進階(Advance)→憑證(Certificates)→檢視憑證清單→選擇欲匯出的憑證→匯出(Export).

Send HTTP Request

If the response field “asciiContent” contains “<?tibco-char x?>”, set “” (empty quotes) to input tab Headers: Accept-Encoding.

Reference: http://tibco-middleware.blogspot.tw

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s