Creating a Job to consume the REST Service with JWT validation using Keycloak
Procedure
-
From the Palette, drag and drop a
tFixedFlowInput, tRESTClient,
tReplicate, two tXMLMap, and
tLogRow components onto the design
workspace.
- Label the components for better identification of their roles and link the them as shown above.
-
In the Basic settings view of the tFixedFlowInput component:
-
Click the [...] button next to
Edit schema to open the Schema dialog box, and edit the input schema as
follows:
-
Select Use Inline Table and configure the inline table
as follows:
-
Click the [...] button next to
Edit schema to open the Schema dialog box, and edit the input schema as
follows:
-
In the Basic settings view of
the tRESTClient component:
- Fill the URL field with "http://localhost:8090".
- In the Relative path field, enter "/services/customers/"+input.number.
- Select the Use Authentication check box and the OAuth2 Bearer authentication type. In the Bearer Token field, copy the access token you got from http://localhost:8080/realms/MyDemoRealm/protocol/openid-connect/token.
-
In the map editor of the tXMLMap component labeled
Map_all:
- Rename the Root node under body of the input table as customers.
- Create a sub-element to customers and name the sub-element customer. Set the customer node as loop element.
- Create sub-elements id, city, firstName, lastName to customer.
- Click the [+] button on the bottom right to add five columns for the output: statusCode of Integer type and id, city, firstName, lastName of String type.
- Click Auto map to map the columns with the same name automatically.
-
Repeat the previous step to map the input and the output tables of the
tXMLMap component labeled
Map_singleton as shown below.
-
In the Basic settings view of the
tLogRow component labeled Log_All,
select Table in the Mode area.
-
In the Basic settings view of the
tLogRow component labeled
Log_Singleton, select Vertical and
Print label modes.
-
Run the Job.
You will get the following response from the REST Service.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!