Skip to main content
Skip table of contents

REST HEAD

Objective

To demonstrate the ability of a Fiorano REST application to interact with an end user by exposing a secured REST service which accepts HTTP PUT requests at a URL and responds with a count of new records inserted into a database successfully.

Prerequisites

  • Start the Fiorano Enterprise Server (FES) and the Fiorano Peer Server (FPS)
  • Login to the eStudio application
    • Get familiar with the basic menus and perspectives (panels) in eStudio application

Scenario

  • Configure the RESTStub component to receive HTTP PUT requests from RESTConsumer and process it as query configured in a DB component. Bind the DB schema to the RESTStub and transform the routes between the RESTStub and the DB.
  • Configure the RESTConsumer component to send HTTP PUT requests triggered using a Feeder component which adapts to the RESTConsumer schema.

How it Works

The REST service gets deployed in the peer server and when a rest client sends a request to the service, the request is available on the output port. The response can be routed back by connecting a route to the input port.

Components used

Setting up the Example

Configuring Server Event Process

Create an Event Process with the name 'REST-HEAD_Server' to configure the server application.

Configuring RESTStub component

The RESTStub component exposes Restful services in the Fiorano environment. To configure the RESTstub component, perform the actions below in the eStudio application:

  1. In the REST-HEAD_Server event processdrag the RESTStub component from the Web category in the Microservice palette to the Fiorano Orchestrator.


     
  2. Double-click the component to open the Configuration Property Sheet (CPS).

    Notice that the RESTStub component does not have any ports attached to it; ports appear only after configuration.

  3. The first screen in the CPS, wizard (1 of 3), is used to define the service using a user interface for WADL. WADL can be created manually by defining different aspects of the service or can load an existing WADL and edit the configurations.
    Provide Service Name as 'Sample' with which the event process functionality is exposed as RESTful service.
    1. Remove GET method
      1. Right-click the GET node and select the Remove Method option to remove the default method.



      2. Right-click resource under the Resources node, go to Add Method and select HEAD option to add the HEAD method.


         
    2. Rename resource path to give logical meaning to the scenario
      1. Click the resource node. 

      2. Under the Resource Configuration tab, replace the default value of Path 'resourcePath' with 'HeadPath'.

      3. Click Next and Fiinish to save the configuration.

Configuring Transformation

Connecting Ports Creating a Route

Connect the ports of the RESTStub.

The dotted line in the route implies that the route is not mapped. Proceed to the Route Transformation section below to perform the mapping.

Route Transformation

To configure transformation between input and output ports of the RESTStub, perform the actions below in the Fiorano Orchestrator:

  1. Right-click the route, point to Configure Transformation and select the Mapper Project option to open the Fiorano Mapper editor.


     
  2. In the Mapper Project, connect the value "resource" in the Input Structures with "MediaType" in the Output Structures:
     

     
  3. Click the Save

    icon (or File > Save) to save the transformation configuration and close the Mapper Project editor.

    Now the dotted line in the route gets transformed to a bold line implying that the route transformation has been done.

Launching the Server Event Process

WADL URL has to be copied from the RESTStub component to use in the RESTConsumer component added in later steps. Perform the actions below in the Fiorano Orchestrator:

  1. Click the Check Resource and Connectivity (CRC) 

    icon (or press ALT+SHIFT+C) to check resources and connectivity.

    Ensure that the security configurations completed in the Profile Management and the RESTStub are in sync with the corresponding configurations for SSL Security or Basic Authentication. Errors may occur while checking resource and connectivity (CRC if these are not configured correctly.
  2. Click the Run Event Process 
    icon (ALT+SHIFT+R) to run the event process.
  3. Right-click the RESTStub component and click the Copy WADL URL option to copy the WADL URL.

Configuring Client Event Process

Create another Event Process with the name REST-HEAD_Client to configure a client event application with a Feeder and Display.

Keep the REST-HEAD_Server Event Process running.

Configuring RESTConsumer

The RESTConsumer component serves as a client to access exposed services within the Fiorano Environment. To configure the RESTConsumer component and communicate with the RESTStub which has an exposed RESTservice, perform the actions below in the REST-HEAD_Client application:

  1. Add the RESTConsumer component from Web category in Microservice Palette to the Fiorano Orchestrator.


  2. Double-click the component to open the Configuration Property Sheet (CPS).



  3. Perform the actions below in the wizard (1 of 3) panel:
    1. Enable the Load WADL option. The From URL option gets active/editable.
    2. Select the From URL option and paste the WADL URL copied from RESTStub onto it.
    3. Click the Load WADL button to apply the RESTStub schemas.

      The "GET" node gets replaced with "HEAD" node as configured in RESTStub and click the resource node to see the renamed Path.

Click Next till the last panel where the Finish button will be enabled and click Finish to close the CPS and to save the configuration. The input and output ports get generated.

The default Connection Configuration works for this example. Check the FES Connection Configuration section for more information about advanced configurations and their functionalities.

Notice that the input port and output port appear after the RESTConsumer configuration is performed.

Configuring Feeder

  1. Add Feeder and Display components from the Util category in the Microservice Palette into the REST-HEAD_Client orchestrator.
  2. Connect the ports of the RESTConsumer to the Feeder and Display components in the following manner:
    1. Output Port of the Feeder component to the Input Port of the RESTConsumer component.
    2. Output Port of the RESTConsumer component to the Input Port of the Display component.
       


  3. Double-click the Feeder component and click the Connected Port Schemas button in the Message Type Configuration panel. Select the last child node ('resource_PUT_Request' in this example) in the Connected ports window to import the RESTConsumer schema into the feeder and click OK.



  4. The Select Root Element text box and the schema editor get populated with the RESTConsumer schema. Click Next.



  5. In the Message Details Configuration panel, click Generate Sample to generate sample, and click OK.

  6. Click the Finish or Save and Close button to complete the Feeder configuration.

Running the Example

To see the REST-HEAD_Client Event Process running in conjunction with REST-HEAD_Server Event Process, perform the actions below in the REST-HEAD_Client Event Process:

  1. Click the Check Resource and Connectivity 
     icon (or press ALT+SHIFT+C) to check the resource and connectivity.
  2. Click the Run Event Process 
     icon (ALT+SHIFT+R) to run the event process. The Feeder and Display windows get opened.
  3. Provide resource parameters (as mapped in the Route Transformation) in the Feeder window and click Send.

    Expand for sample input
    CODE
    <ns1:Request xmlns:ns1="http://www.fiorano.com/services/rest">
       <ResourceParameters>
          <resource/>
       </ResourceParameters>
    </ns1:Request>



  4. If the data is successfully sent, Response Status code shows "200" in the Display window.

     

Reference


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.