WORKLOAD AUTOMATION COMMUNITY
  • Home
  • Blogs
  • Forum
  • Resources
  • Events
    • IWA 9.5 Roadshows
  • About
  • Contact
  • What's new

Case Study : RESTFUL Booking Application through Workload Automation

7/13/2020

0 Comments

 
Picture
This Blog aims to showcase a Case Study on how Truck Bookings can be made on a  RESTFul Application developed in Python and how Vendors can respond to the Request through Booking Confirmations made through RESTFul Calls completely trigerred and managed through Workload Automation. ​
We have a REST API Program developed in Python using Flask, running in the background on a Server ,the data is stored on a Mongo DB and this API can process the below types of queries : 
  1. Get Requests made against it to retrieve the list of Booking Requests made on the Application. 
  2. Get Request to retrieve a Particular Booking Request made against the Application. 
  3. Post Requests made against it to make fresh Truck Bookings on the RESTFul Application. 
Picture
So, in order to retrieve the list of bookings from such an Application , the company plans to use Workload Scheduler , the get action is defined as a RESTFul Job using the RESTFul Job Type , the job is defined as follows , the Service URL in the Job would be the link which is being hit in the Application , this would be a GET Method Type Job , you would also be filling out the User ID and Password or have Certificate Based Authentication using a keystore Path and password to hit the Service URL in the Authentication tab : ​
Picture
The job when executed would send a JSON Response in the Joblog output as shown below with a listing of all Booking Requests made : ​
Picture
Job                                                   RESTFUL_GET_ALLBOOKINGS 
Workstation (Job)                            AGENT 
Job Stream                                      JOBS 
Workstation (Job Stream)               AGENT 

=============================================================== 
= JOB       : AGENT#JOBS[(0330 05/25/20),(CF20145AAAAAAAAD)].RESTFUL_GET_ALLBOOKINGS 
= TASK      : <?xml version="1.0" encoding="UTF-8"?> 
<jsdl:jobDefinition xmlns:jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl" xmlns:jsdlrestful="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdlrestful" name="RESTFUL"> 
  <jsdl:variables> 
    <jsdl:stringVariable name="tws.jobstream.name">JOBS</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.jobstream.id">JOBS</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.name">RESTFUL_GET_ALLBOOKINGS</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.workstation">AGENT</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.iawstz">202005250330</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.promoted">NO</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.resourcesForPromoted">10</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.num">850043560</jsdl:stringVariable> 
  </jsdl:variables> 
  <jsdl:application name="restful"> 
    <jsdlrestful:restful> 
<jsdlrestful:RestfulParameters> 
<jsdlrestful:Authentication> 
<jsdlrestful:credentials> 
<jsdl:userName/> 
<jsdl:password>{aes}MvwiATDb+mZbkSTdrSBDb8AAolOo3TwNhrlCxC9a1Iw=</jsdl:password> 
</jsdlrestful:credentials> 
<jsdlrestful:CertificateGroup> 
<jsdlrestful:keyStoreFilePath/> 
<jsdlrestful:password/> 
<jsdlrestful:HostnameVerifyCheckbox/> 
</jsdlrestful:CertificateGroup> 
</jsdlrestful:Authentication> 
<jsdlrestful:RESTAction> 
<jsdlrestful:URI>http://127.0.0.1:5000/api/v1/resources/requests/all</jsdlrestful:URI> 
<jsdlrestful:method>GET</jsdlrestful:method> 
<jsdlrestful:outputFileName/> 
 
</jsdlrestful:RESTAction> 
<jsdlrestful:Body> 
<jsdlrestful:contentType>application/json</jsdlrestful:contentType> 
<jsdlrestful:BodyGroup> 
<jsdlrestful:FileBody> 
<jsdlrestful:InputFileName/> 
</jsdlrestful:FileBody> 
</jsdlrestful:BodyGroup> 
</jsdlrestful:Body> 
<jsdlrestful:Advanced> 
 
<jsdlrestful:Accept/> 
<jsdlrestful:JSONPropertiesGroup> 
<jsdlrestful:JsonObjectResultQuery/> 
</jsdlrestful:JSONPropertiesGroup> 
<jsdlrestful:NumberOfRetries>0</jsdlrestful:NumberOfRetries> 
<jsdlrestful:RetryIntervalSeconds>30</jsdlrestful:RetryIntervalSeconds> 
</jsdlrestful:Advanced> 
</jsdlrestful:RestfulParameters> 
</jsdlrestful:restful> 
  </jsdl:application> 
  <jsdl:resources> 
    <jsdl:orderedCandidatedWorkstations> 
      <jsdl:workstation>3646FC79FFB046588013F5C87F3F0A4A</jsdl:workstation> 
    </jsdl:orderedCandidatedWorkstations> 
  </jsdl:resources> 
</jsdl:jobDefinition> 
= TWSRCMAP  :  
= AGENT     : AGENT 
= Job Number: 850043560 
= Mon 05/25/2020 15:08:07 IST 
=============================================================== 
{ 
  "result": [ 
    { 
      "Date": "05/25/2020",  
      "Destination": "Mumbai",  
      "Source": "Bengaluru",  
      "Time": "10:00PM",  
      "Type": "5 Ton(17 ft)",  
      "id": 2 
    },  
    { 
      "Date": "05/25/2020",  
      "Destination": "Mumbai",  
      "Source": "Bengaluru",  
      "Time": "10:00PM",  
      "Type": "5 Ton(17 ft)",  
      "id": 2 
    },  
    { 
      "Date": "05/25/2020",  
      "Destination": "Mumbai",  
      "Source": "Bengaluru",  
      "Time": "10:00PM",  
      "Type": "5 Ton(17 ft)",  
      "id": 2 
    } 
  ] 
} 
 
 
=============================================================== 
= Exit Status           : 0 
= Elapsed Time (hh:mm:ss) : 00:00:01 
= Mon 05/25/2020 15:08:07 IST 
=============================================================== 
 ​
Likewise when a New Booking Request is made , a job is executed in the Background which would post the New Booking Request to the Mongo DB .  
​

The Job defined would include the Service URL of the Application and the Method selected as “POST” . The form filled in a Booking Portal is passed in the form of JSON Input and the Job posts this against the Mongo DB : ​
Picture
Picture
Job                                                           RESTFUL_POST_TRUCKBOOKING 
Workstation (Job)                                    AGENT 
Job Stream                                              JOBS 
Workstation (Job Stream)                       AGENT 
=============================================================== 
= JOB       : AGENT#JOBS[(0330 05/26/20),(JOBS)].RESTFUL_POST_TRUCKBOOKING 
= TASK      : <?xml version="1.0" encoding="UTF-8"?> 
<jsdl:jobDefinition xmlns:jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl" xmlns:jsdlrestful="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdlrestful" name="RESTFUL"> 
  <jsdl:variables> 
    <jsdl:stringVariable name="tws.jobstream.name">JOBS</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.jobstream.id">JOBS</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.name">RESTFUL_POST_TRUCKBOOKING</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.workstation">AGENT</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.iawstz">202005260330</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.promoted">NO</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.resourcesForPromoted">10</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.num">850044088</jsdl:stringVariable> 
  </jsdl:variables> 
  <jsdl:application name="restful"> 
    <jsdlrestful:restful> 
<jsdlrestful:RestfulParameters> 
<jsdlrestful:Authentication> 
<jsdlrestful:credentials> 
<jsdl:userName/> 
<jsdl:password>{aes}zmbgqdnW6ZCRQwb8vv7DepBfs731FXNJXPzJ913t0/8=</jsdl:password> 
</jsdlrestful:credentials> 
<jsdlrestful:CertificateGroup> 
<jsdlrestful:keyStoreFilePath/> 
<jsdlrestful:password/> 
<jsdlrestful:HostnameVerifyCheckbox/> 
</jsdlrestful:CertificateGroup> 
</jsdlrestful:Authentication> 
<jsdlrestful:RESTAction> 
<jsdlrestful:URI>http://127.0.0.1:5000/api/v1/resources/requests</jsdlrestful:URI> 
<jsdlrestful:method>POST</jsdlrestful:method> 
<jsdlrestful:outputFileName/> 
 
</jsdlrestful:RESTAction> 
<jsdlrestful:Body> 
<jsdlrestful:contentType>application/json</jsdlrestful:contentType> 
<jsdlrestful:BodyGroup> 
<jsdlrestful:TextBody> 
<jsdlrestful:InputTextBody/> 
</jsdlrestful:TextBody> 
</jsdlrestful:BodyGroup> 
</jsdlrestful:Body> 
<jsdlrestful:Advanced> 
 
<jsdlrestful:Accept/> 
<jsdlrestful:JSONPropertiesGroup> 
<jsdlrestful:JsonObjectResultQuery/> 
</jsdlrestful:JSONPropertiesGroup> 
<jsdlrestful:NumberOfRetries>0</jsdlrestful:NumberOfRetries> 
<jsdlrestful:RetryIntervalSeconds>30</jsdlrestful:RetryIntervalSeconds> 
</jsdlrestful:Advanced> 
</jsdlrestful:RestfulParameters> 
</jsdlrestful:restful> 
  </jsdl:application> 
  <jsdl:resources> 
    <jsdl:orderedCandidatedWorkstations> 
      <jsdl:workstation>3646FC79FFB046588013F5C87F3F0A4A</jsdl:workstation> 
    </jsdl:orderedCandidatedWorkstations> 
  </jsdl:resources> 
</jsdl:jobDefinition> 
= TWSRCMAP  :  
= AGENT     : AGENT 
= Job Number: 850044088 
= Tue 05/26/2020 10:08:38 IST 
=============================================================== 
POST Successful 
 
=============================================================== 
= Exit Status           : 0 
= Elapsed Time (hh:mm:ss) : 00:00:01 
= Tue 05/26/2020 10:08:38 IST 
=============================================================== 
 ​
Picture
Inorder to retrieve a booking for a Booking ID , a job would be run which would get a Truck Booking Application passing the ID in the Service URL as follows , this would be a RESTFUL GET Job as shown below : ​
Picture
Picture
Job                                                                  RESTFUL_GET_TRUCKINFO 
Workstation (Job)                                           AGENT 
Job Stream                                                     JOBS 
Workstation (Job Stream)                              AGENT 
=============================================================== 
= JOB       : AGENT#JOBS[(0330 05/26/20),(JOBS)].RESTFUL_GET_TRUCKINFO 
= TASK      : <?xml version="1.0" encoding="UTF-8"?> 
<jsdl:jobDefinition xmlns:jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl" xmlns:jsdlrestful="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdlrestful" name="RESTFUL"> 
  <jsdl:variables> 
    <jsdl:stringVariable name="tws.jobstream.name">JOBS</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.jobstream.id">JOBS</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.name">RESTFUL_GET_TRUCKINFO</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.workstation">AGENT</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.iawstz">202005260330</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.promoted">NO</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.resourcesForPromoted">10</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.num">850044087</jsdl:stringVariable> 
  </jsdl:variables> 
  <jsdl:application name="restful"> 
    <jsdlrestful:restful> 
<jsdlrestful:RestfulParameters> 
<jsdlrestful:Authentication> 
<jsdlrestful:credentials> 
<jsdl:userName/> 
<jsdl:password>{aes}3pIZo56cOJkT3Ri+IpkgVHu75fXyGr+0RGqh3tYiVTc=</jsdl:password> 
</jsdlrestful:credentials> 
<jsdlrestful:CertificateGroup> 
<jsdlrestful:keyStoreFilePath/> 
<jsdlrestful:password/> 
<jsdlrestful:HostnameVerifyCheckbox/> 
</jsdlrestful:CertificateGroup> 
</jsdlrestful:Authentication> 
<jsdlrestful:RESTAction> 
<jsdlrestful:URI>http://127.0.0.1:5000/api/v1/resources/requests?id=0</jsdlrestful:URI> 
<jsdlrestful:method>GET</jsdlrestful:method> 
<jsdlrestful:outputFileName/> 
 
</jsdlrestful:RESTAction> 
<jsdlrestful:Body> 
<jsdlrestful:contentType>application/json</jsdlrestful:contentType> 
<jsdlrestful:BodyGroup> 
<jsdlrestful:FileBody> 
<jsdlrestful:InputFileName/> 
</jsdlrestful:FileBody> 
</jsdlrestful:BodyGroup> 
</jsdlrestful:Body> 
<jsdlrestful:Advanced> 
 
<jsdlrestful:Accept/> 
<jsdlrestful:JSONPropertiesGroup> 
<jsdlrestful:JsonObjectResultQuery/> 
</jsdlrestful:JSONPropertiesGroup> 
<jsdlrestful:NumberOfRetries>0</jsdlrestful:NumberOfRetries> 
<jsdlrestful:RetryIntervalSeconds>30</jsdlrestful:RetryIntervalSeconds> 
</jsdlrestful:Advanced> 
</jsdlrestful:RestfulParameters> 
</jsdlrestful:restful> 
  </jsdl:application> 
  <jsdl:resources> 
    <jsdl:orderedCandidatedWorkstations> 
      <jsdl:workstation>3646FC79FFB046588013F5C87F3F0A4A</jsdl:workstation> 
    </jsdl:orderedCandidatedWorkstations> 
  </jsdl:resources> 
</jsdl:jobDefinition> 
= TWSRCMAP  :  
= AGENT     : AGENT 
= Job Number: 850044087 
= Tue 05/26/2020 10:07:02 IST 
=============================================================== 
[ 
  { 
    "Date": "05/20/2020",  
    "Destination": "Chennai",  
    "Source": "Mumbai",  
    "Time": "08:00AM",  
    "Type": "4 Ton(14 ft)",  
    "id": 0 
  } 
] 
 
 
=============================================================== 
= Exit Status           : 0 
= Elapsed Time (hh:mm:ss) : 00:00:01 
= Tue 05/26/2020 10:07:02 IST 
=============================================================== 
 
The JSON Response retrieved can be viewed in the Joblog as shown above.
​
 
In order to commit on a Truck Booking Request on the Portal, the Vendor willing to fulfill the Request would confirm the booking Details and a Commitment Time of the request , a RESTFul application running in the background as below would serve to fulfill the same : ​
Picture
A job called RESTFUL_TRUCKINFO_COMMITMENT would get called which would be calling the URL http://127.0.0.1:5000/api/v1/resources/commitments to confirm the Booking, this would be a RESTFUL Post Type Job which would as shown below: ​
Picture
Picture
Picture
Picture
The Joblog of this job execution would be as follows : 
Job                                                                          RESTFUL_TRUCKINFO_COMMITMENT 
Workstation (Job)                                                   AGENT 
Job Stream                                                             JOBS 
Workstation (Job Stream)                                      AGENT 
=============================================================== 
= JOB       : AGENT#JOBS[(0330 05/25/20),(CF20145AAAAAAAAD)].RESTFUL_TRUCKINFO_COMMITMENT 
= TASK      : <?xml version="1.0" encoding="UTF-8"?> 
<jsdl:jobDefinition xmlns:jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl" xmlns:jsdlrestful="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdlrestful" name="RESTFUL"> 
  <jsdl:variables> 
    <jsdl:stringVariable name="tws.jobstream.name">JOBS</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.jobstream.id">JOBS</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.name">RESTFUL_TRUCKINFO_COMMITMENT</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.workstation">AGENT</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.iawstz">202005250330</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.promoted">NO</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.resourcesForPromoted">10</jsdl:stringVariable> 
    <jsdl:stringVariable name="tws.job.num">850044094</jsdl:stringVariable> 
  </jsdl:variables> 
  <jsdl:application name="restful"> 
    <jsdlrestful:restful> 
<jsdlrestful:RestfulParameters> 
<jsdlrestful:Authentication> 
<jsdlrestful:credentials> 
<jsdl:userName/> 
<jsdl:password>{aes}+6ud69aC05miii+GX9AepE1U3XM8AZ7bvXjmV8CMZwA=</jsdl:password> 
</jsdlrestful:credentials> 
<jsdlrestful:CertificateGroup> 
<jsdlrestful:keyStoreFilePath/> 
<jsdlrestful:password/> 
<jsdlrestful:HostnameVerifyCheckbox/> 
</jsdlrestful:CertificateGroup> 
</jsdlrestful:Authentication> 
<jsdlrestful:RESTAction> 
<jsdlrestful:URI>http://127.0.0.1:5000/api/v1/resources/commitments</jsdlrestful:URI> 
<jsdlrestful:method>POST</jsdlrestful:method> 
<jsdlrestful:outputFileName/> 
 
</jsdlrestful:RESTAction> 
<jsdlrestful:Body> 
<jsdlrestful:contentType>application/json</jsdlrestful:contentType> 
<jsdlrestful:BodyGroup> 
<jsdlrestful:TextBody> 
<jsdlrestful:InputTextBody/> 
</jsdlrestful:TextBody> 
</jsdlrestful:BodyGroup> 
</jsdlrestful:Body> 
<jsdlrestful:Advanced> 
 
<jsdlrestful:Accept/> 
<jsdlrestful:JSONPropertiesGroup> 
<jsdlrestful:JsonObjectResultQuery/> 
</jsdlrestful:JSONPropertiesGroup> 
<jsdlrestful:NumberOfRetries>0</jsdlrestful:NumberOfRetries> 
<jsdlrestful:RetryIntervalSeconds>30</jsdlrestful:RetryIntervalSeconds> 
</jsdlrestful:Advanced> 
</jsdlrestful:RestfulParameters> 
</jsdlrestful:restful> 
  </jsdl:application> 
  <jsdl:resources> 
    <jsdl:orderedCandidatedWorkstations> 
      <jsdl:workstation>3646FC79FFB046588013F5C87F3F0A4A</jsdl:workstation> 
    </jsdl:orderedCandidatedWorkstations> 
  </jsdl:resources> 
</jsdl:jobDefinition> 
= TWSRCMAP  :  
= AGENT     : AGENT 
= Job Number: 850044094 
= Tue 05/26/2020 10:38:26 IST 
=============================================================== 
POST Successful 
 
=============================================================== 
= Exit Status           : 0 
= Elapsed Time (hh:mm:ss) : 00:00:01 
= Tue 05/26/2020 10:38:27 IST 
=============================================================== 
 
The Successful Post would create a New Commitment in a table in the MongoDB for the Application. 

​Snippet of the type of Application running in the Background against which the IWS jobs are run , the below Implementation can be extended and made more complex as desired : ​
Picture
Picture

Authors's Bio
Picture
Sriram V, Tech Sales, HCL Technologies 

I’ve been working with Workload Automation for the last 11 years in various capacities like WA Administrator , SME , India-SME , later joined the Product team supporting Workload Automation on SaaS, recently moved to Tech Sales and Lab Services of Workload Automation. ​
View my profile on LinkedIn
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    Archives

    March 2023
    February 2023
    January 2023
    December 2022
    September 2022
    August 2022
    July 2022
    June 2022
    May 2022
    April 2022
    March 2022
    February 2022
    January 2022
    December 2021
    October 2021
    September 2021
    August 2021
    July 2021
    June 2021
    May 2021
    April 2021
    March 2021
    February 2021
    January 2021
    December 2020
    November 2020
    October 2020
    September 2020
    August 2020
    July 2020
    June 2020
    May 2020
    April 2020
    March 2020
    January 2020
    December 2019
    November 2019
    October 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    August 2017
    July 2017
    June 2017
    May 2017

    Categories

    All
    Analytics
    Azure
    Business Applications
    Cloud
    Data Storage
    DevOps
    Monitoring & Reporting

    RSS Feed

www.hcltechsw.com
About HCL Software 
HCL Software is a division of HCL Technologies (HCL) that operates its primary software business. It develops, markets, sells, and supports over 20 product families in the areas of DevSecOps, Automation, Digital Solutions, Data Management, Marketing and Commerce, and Mainframes. HCL Software has offices and labs around the world to serve thousands of customers. Its mission is to drive ultimate customer success with their IT investments through relentless innovation of its products. For more information, To know more  please visit www.hcltechsw.com.  Copyright © 2019 HCL Technologies Limited
  • Home
  • Blogs
  • Forum
  • Resources
  • Events
    • IWA 9.5 Roadshows
  • About
  • Contact
  • What's new