Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To demonstrate the ability of a Fiorano REST application to interact with an end-user by exposing a secured REST service which that accepts HTTP DELETE requests at a URL and responds with a count of records deleted from the database successfully.

...

  • Configure the RESTStub component to receive HTTP DELETE requests from RESTConsumer and process it as a 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 DELETE requests triggered using a Feeder component which that adapts to the RESTConsumer schema.

...

  1. In the REST-DELETE_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).

    Note

    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.

  4. Under the Create/Edit WADL section, perform the actions below:

    1. Bind the DB input port and output port schemas to the RESTStub
      1. Click Schemas under the Configuration tab.

        Note

        Port Schemas appear only if the DB component is configured correctly.

      2. In the Schemas Configuration section, click the Add  button and click Load from Port Schemas option

      3. In the Select Port dialog box that is displayed, select 'IN_PORT'.



      4. Similarly, select the OUT_PORT too and click OK. Both schemas get added under the Schemas section.

    2. Add DELETE method
      1. Right-click the GET node and select the Remove Method option to remove the default method.



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


         
    3. 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 'deleteData'.



    4. Add the request SQL element to the DELETE node
      1. Click the DELETE node.

      2. Click the  Parameters tab under Method Configuration.
      3. In the Name field, enter “eid” and also enter “eid” in the ID field and select Style as "query".

        Image Added

      4. Click the Add  button under the Request Configuration tab.

      5. Click the ellipsis  button under the Representation tab.

      6. In the Select Element window displayed, select "SQL_CFG_1" under Request element and click OK.



    5. Add the response SQL element to DELETE node
      1. Right-click the DELETE node and click the Add Response option. The Response node is displayed.

      2. Click the Response node
      3. Click the Add  button under the Response Configuration tab.

      4. Click the ellipsis  button under the Representation tab.

      5. In the Select Element window, select "SQL_CFG_1" under the Response element and click OK.

...

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


     
  2. In the Mapper Project, connect values in and map “eid” from Input Structures and to Output Structures as below:
  3. de to ZERO MANY

  4. eid
    Image Removed
    Image Added
     
  5. Click the Save icon (or File > Save) to save the transformation configuration and close the Mapper Project editor.

  6. Similarly, for route2, go to the Mapper Project window and connect "UpdateCount".



  7. Save the mapping configuration as explained in step 3.

    Info

    Now the dotted lines in the route are transformed to bold lines implying that the route transformation has been done.

...

  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 the required column values (in this example, eid: 101) in the Feeder window and click Send.

    Expand
    titleExpand for sample input
    Code Block
    <ns1:Request xmlns:ns1="http://www.fiorano.com/services/rest">
       <ResourceParameters>
          <resource/>
       </ResourceParameters>
       <Representations><RequestParameters>
          <Representation MediaType="application/xml">
             <Element>
                <ns2:SQL_CFG_1 xmlns:ns2="http://www.fiorano.com/fesb/activity/DB1/Request" id="-4827304138918607872">
                   <ns2:de>
                      <ns2:eid>101</ns2:<eid>101</eid>
                   </ns2:de>
                </ns2:SQL_CFG_1>
             </Element>
          </Representation>
       </Representations>
    </RequestParameters>
    </ns1:Request>

    Image RemovedImage Added

    Info

    This changes the name inserted using RESTPOST.


  4. If the DELETE query is successful, 'UpdateCount' shows "1" in the Display window.

     Image RemovedImage Added

    Note

    In order to verify, GET method can be used in DB before and after the deletion of data.

    Code Block
    titleGET method to retrieve existing data in the DB table
    SELECT "public"."emp"."ename", "public"."emp"."eid" FROM "public"."emp"   

    Click Execute in the DB Test Interation Specifications Panel; it shows as an empty screen as the lone data in the DB is removed.


...

Adaptavist ThemeBuilder EngineAtlassian Confluence