Testing Request-Reply Maps with Postman or Fiddler

Testing Request-Reply Maps with Postman or Fiddler

book

Article ID: KB0078841

calendar_today

Updated On:

Products Versions
TIBCO Cloud Integration - Connect ( Scribe ) -

Description

Once a Request/Reply Map has been created the next step is to verify that the Event based Map can send and receive data.
This can be done a number of ways but Fiddler and Postman are two of the more commonly used utilities that can be used for this purpose. Both can be downloaded for free from the web.

Creating a Request/Reply Map in SOL

For more information on creating a Request/Reply Map see the following sections of the TIBCO Scribe Online Help:
Defining an Event Request/Reply Map
Request/Reply Map Example

Create a new IS Event Solution
Create a Request/Reply Map
The basic structure for a Request-Reply map is shown below:
  • Wait for the Request
  • Do Something (e.g. create account in CRM)
  • Send back a Reply (optional)
User-added image

Wait for Request Block

Add a Wait for Request Block. This Block acts as a listener and waits for some process to send it a request/data.

Open the block and type in the field names that the Request Block would expect to receive. In this example, the Map creates/updates an account in CRM. For the target, the names can be anything but matching the target field names makes it easier to map. The fields specified here must be exactly the same as the process that is sending the JSON request to TIBCO Scribe® Online. Different data types can be selected and in this case all happen to be strings.

User-added image

User-added image

Update/Insert Block

User-added image

This is where you add the traditional Map Blocks such as Update/Insert or Lookup. Map the fields as you normally would.


User-added image


Add The Build And Send Reply Blocks

User-added image

This is only required if you intend to send information back to the process sending the request. For Postman, there isn’t anything special you need to do other than mapping the field(s). For other connections, such as Marketo, there is a url where the reply is sent.

In the Build Reply Block map the field(s) to send back. In some cases the field names need to match the calling process and in other cases they can be anything. For Postman, it can be anything. Nothing needs to be configured for the Send Reply Block.


User-added image

Save the Map and Solution.
Reopen the Solution and Map.
Open the Wait for Request Block.
A url/endpoint is generated and this is the url that needs to be specified in Postman or other sending system.

User-added image

TIBCO Scribe® Online Security

See Setting Security Options in the TIBCO Scribe® Online Help for more information.

Security options control access to a TIBCO Scribe® Online Organization. An Organization can be accessed directly by users, or by other software via the API or an Endpoint URL. From the Security dialog for each Organization, you can:
  • Create Security rules for access to the TIBCO Scribe® Online API and TIBCO Scribe® Online Endpoint URL for Configuring an IS Event Solution.
  • Copy or reset the access token for the TIBCO Scribe® Online Endpoint URL. This option is only for Event Solutions.
  • Copy or reset the cryptographic token for the TIBCO Scribe® Online API.
  • Determine whether you want to store source data for record errors in the cloud or on the computer on which the On-Premise Agent is installed.

User-added image


Using Postman for Testing

Enter the URL/Endpoint from the Wait for Request Block and select POST.
Set Authorization - Type = No Auth.

User-added image

Set Header – Content Type = Application/JSON

User-added image

Body – Select JSON.

User-added image

Create/Enter the JSON that would normally be sent to the Wait for Request Block.
Click the Send button.

User-added image

{
   'AccountNumber' : 'HTX-00023',
   'Name' : 'Stark Industries', 
   'Address' : '444 Box Canyon Rd',
   'City' : 'Tuscon',
   'State' : 'AZ',
   'Zip' : '80551',
   'Email' : 'starkcorp@stark.com',
   'Telephone' : '520-205-1457'

}

Using Fiddler for Testing

To send a Post Using Fiddler:

Create the Request/Reply Map as shown at the beginning of this article.
In Fiddler, click the Composer Tab.
Enter the URL/Endpoint for the Wait for Request Block.
Set Type to POST and enter the Content Type in the Header:    Content-Type: application/json; charset=utf-8
Click Execute.

User-added image

Checking the Response

Use Fiddler as you would normally would to see the Response (send reply) and the more such as the TIBCO Scribe® Online connection and API calls.

User-added image

Using RequestBin to Trace HTTP Requests

https://requestbin.herokuapp.com/

RequestBin can be used to view the HTTP Post sent to the Request block from third party systems (e.g. Marketo, CRM…) to view the JSON code.
Normally posts from other systems are done programmatically and the JSON code is constructed using variables that get populated at runtime. So you can’t view the JSON code on the source system to verify it is in the proper format. For example here is a snippet of code that is sending the Post from CRM:

User-added image


RequestBin allows you to view the generated JSON code. View the code by sending the Request using the RequestBin URL instead of the TIBCO Scribe® Online URL/Endpoint.

Generate a RequestBin URL

User-added image

Copy the URL generated by RequestBin.
Change the URL in the code that is sending the request. In this case it is Postman but it could be anything (CRM, Marketo..).

User-added image

In RequestBin click on the generated URL link.
View the Request and ensure it is formatted properly.

User-added image

 

Issue/Introduction

Once a Request/Reply Map has been created the next step is to verify the Event based map can send and receive data. This can be done a number of ways but Fiddler and Postman are two of the more commonly used utilities that can be used for this purpose.