Search Results

Invoking REST Services without their Swagger File

Not all REST services have accompanying Swagger files. TIBCO Business Studio allows you to invoke a REST service without having access to its Swagger file as long as you have the endpoint URL for the service. You use the REST Reference Wizard in TIBCO Business Studio to do so.

The wizard invokes the service using the URL for its endpoint. It also allows you to choose which operation to implement as well as set up the data elements used for the request and the response of each operation. You can also add operations after the reference has been created.

Prerequisites

  • You must have the REST endpoint URL and know which operations are supported by the service
  • The REST service you want to invoke must be running
The high-level steps to create a REST reference using its wizard in TIBCO Business Studio are as follows:
  1. Obtain the URL for the service's endpoint.
  2. Verify that the service is running.
  3. Obtain the JSON payload from the service.
  4. Generate a XML schema from the JSON payload in TIBCO Business Studio.
  5. Create a new project in TIBCO Business Studio.
  6. Use the REST Reference wizard to create the reference.

Obtain the URL for the service endpoint

Typically, the endpoint URL can be obtained from the web page where the service is described. This web page typically lists the details of the service such as the operations the service supports and the parameters used.

Verify the service is running

You can verify that the service is running by pasting its endpoint URL into any REST client to GET an object. If the service is running, the REST GET operation will return the JSON payload for the object.

Copy the JSON payload to your clip board or a file. You will need this to generate an XML schema for it.

Generate an XML schema from the JSON payload

To create a REST reference to invoke the service, you must have an XML schema in TIBCO Business Studio for the objects that the service supports. To create the schema in TIBCO Business Studio, do the following:
  1. Right-click the Schemas folder in Project Explorer and select New > XML Schema File from JSON Payload

  2. Enter a file name for the schema and paste the JSON payload you obtained from the service into the JSON Sample text box and click Next and then Finish.

  3. Expand the Schemas folder. You should see the generated schema file with the name that you specified. Optionally, view the contents of the file by opening it in the XML Schema Editor (right-click schema file and select Open With > XML Schema Editor).

Create a new application and open the REST Reference Wizard

  1. Create a new application to contain your REST reference. Refer to the section, Creating an Application in the Application Development Guide.
  2. Click the Create REST Reference icon to open the REST Reference wizard.

  3. Enter the URL for the service in the Service URL text box.
  4. Select the operations that you want the reference to have by clicking their checkbox(s) and click Next.
  5. Configure the request and response type for your operations in the Configuring the Operation screen by selecting the request and response type from their respective drop-down menus. Click Finish. The wizard creates a REST reference binding on the left hand side of your Process Editor.
  6. Open the Reference properties view by clicking on the reference.

  7. Click the HTTP Client link to open the HTTP Client Shared Resource configuration page and verify that the Default Host has been set to the host where the service resides. You can optionally do the following in the Reference properties view:
    • Add path parameters for your operation(s) by appending the parameter to the Resource Service Path.
    • Configure operation details, such as Request and Response for an operation by clicking on the operation in the Operations table, then configure the Response and/or Request details in their respective tabs in the Operation Details section
  8. Optionally, you can add an operation using the Create REST Operation wizard. To open this wizard, hover over the REST reference until you see the icon for the wizard, then click the icon:

    On the Create new REST Operations page, select the operation you want to create and click Next. Configure the Request and Response for the operation if need be and click Finish. You have the option to configure your request and response for the operation at a later time too from the Reference properties view.

You can now invoke any operation by dragging and dropping it in the process editor.