Oracle by Example brandingCreating an Orchestration to Invoke an External REST Service

section 0Before You Begin

This 40-minute OBE (Oracle By Example) shows you how to create an orchestration that can invoke an external REST service.

For this example, a REST service on the  JD Edwards EnterpriseOne Application Interface Services (AIS) Server serves as the “external” REST service. In a real-world scenario, you would call an external service exposed by a third-party provider instead of the AIS Server. But this example show you the general process to follow to invoke an external REST service, without requiring you to register with a third-party to gain access to their services.

You will create an orchestration with a REST connector to call an “external” REST service to retrieve address book information that includes city and state information. You will add a data request to the orchestration that uses the city and state information retrieved from the REST connector to find a record in the F0117 table (Postal Codes) table in EnterpriseOne. Lastly, you will test the orchestration to verify that it returns the requested data.

Optionally, you can continue to the Open API exercises (section 7,8, and 9), to learn how to call a REST service that exposes a Swagger or Open API descriptor.

Background

In the Orchestrator Studio, you can configure a connector to invoke a REST service.  The Connector design page in the Orchestrator Studio provides a test feature that enables you to test the connector and view the JSON response of the REST service call.

What Do You Need?

  • JD Edwards EnterpriseOne test environment with a minimum of EnterpriseOne Tools 9.2.5.0.
  • An AIS Server running and accessible (based on network configuration) to your Orchestrator Studio.

section 1Creating a Connection to the External AIS Server

A connector requires a connection, which provides access to the external resource, in this case the server where the REST service resides.

For this example, you can configure the connection to access the same AIS Server configured with the Orchestrator Studio or a different AIS Server if you have another one set up.

  1. On the Orchestrator Studio Home page, click the Connections icon.
    Alternatively, you can click the Tools menu and select Connections.
  2. Click the New button and select REST.
  3. On Connection Information, complete these fields:
    • Name = EXTERNALAIS
    • Description = External AIS Call
  4. On the Service Information tab, in the Endpoint field, enter the URL for accessing the AIS REST services:
    https://<youraisserver:port>/jderest/v2
  5. On the Security tab, select Basic Authentication and then complete these fields to enable access to the external service:
    • User = Enter an EnterpriseOne user authorized to access the V0101B business view in the EnterpriseOne Data Browser.
    • Password = Enter the password for the EnterpriseOne user.
  6. Note: Again, for this example, the external resource is a REST service on the AIS Server, which is used to retrieve data from EnterpriseOne. In the next task, you will create a connector that uses this connection to the REST service to retrieve data from the V0101B business view in EnterpriseOne. Therefore, the connection must include EnterpriseOne user credentials authorized to view the data for the specified business view in the EnterpriseOne Data Browser.

  7. Enter proxy information on the Proxy tab if necessary for your network configuration.
    This is more probable if connecting to a real third-party service.
    Connection Information
  8. Save the record.

section 2Creating the Connector

In this task, you will create a connector to call a REST service.  The specific REST service we will invoke is documented here: Simple View Query v2 (GET) /jderest/v2/dataservice/view/{viewName}

  1. On the Orchestrator Studio Home page, click the Connectors icon.
  2. Click the New button and select REST.
  3. On the Connector page, complete the following fields:
    • Name= Get Address Book Records
    • Enter Short Description = Retrieve address book records from the external AIS Server.
  4. Click the Product Code drop-down list and select 55 for a customer product code.
  5. From the REST drop-down list, select the EXTERNALAIS connection, which you created in the previous task.
    Leave the HTTP Method as a GET since this API uses the GET method.
  6. Expand the Pathing section and in the Value grid, build the path to the REST service endpoint by entering the following values in consecutive rows:
    • dataservice
    • view
    • V0101B
    After entering these values, the service path displayed above the Value grid should look like this:
    http://<youraisserver:port>/jderest/v2/dataservice/view/V0101B
  7. In the Parameters section, enter the following key value pair:
    $filter F0101.AN8 EQ ${AddressNumber}
    This parameter enables you to filter the data, requesting the record with AN8 matching the input variable AddressNumber.

    Click here to review the output for this API, which you will refine in the next step.
  8. To limit the output to a few returned values, expand the Response section and the Output section.
  9. Enter the following output values in the JSON table:
    Output Variable Name
    fs_DATABROWSE_V0101B.data.gridData.rowset[0].F0101_ALPH Name
    fs_DATABROWSE_V0101B.data.gridData.rowset[0].F0101_AT1 Type
    fs_DATABROWSE_V0101B.data.gridData.rowset[0].F0116_CTY1 City
    fs_DATABROWSE_V0101B.data.gridData.rowset[0].F0116_ADDS State
  10. Save the connector.
  11. To test the service call, click the Test button, enter address number 1 and click Execute.
  12. First you will see the response directly from the service. Make sure you receive the expected output of one record for address 1.
  13. Click the Show Output button and verify that you received only the four pathed items you entered.
  14. Close the test window.

section 3Adding the Connector to an Orchestration

In this task, you will create an orchestration, from the connector created in the previous task to the orchestration. The system automatically populates the inputs, transformations, and outputs.

  1. In the connector page you just finished creating, click the Manage menu, and then click Create Orchestration.
  2. On the Orchestration design page, complete these fields:
    • Orchestration = External REST to AIS
    • Enter Short Description = Call a REST service to retrieve address book information.
  3. Click the Product Code drop-down list and select 55 for a customer product code.
  4. Verify that the inputs, transformations, and outputs are automatically populated
    • Click the Start node and select Inputs and Values, verify that the input value for AddressNumber is already added.
    • Click the Connector node and select Transformations, verify that the AddressNumber value is already mapped.
    • Click the End node and select Outputs and Assertions, verify that the four output values are already selected.
  5. In the Output column, rename the four outputs with these simple names:
    • Name
    • Type
    • City
    • State
  6. Output Column
  7. Save the Orchestration.
  8. External REST to AIS Orchestration

section 4Testing the Orchestration

  1. Double-click the Start node of the orchestration. Alternatively, you can click the Tools menu and select Run Orchestration. The orchestration will already be selected for you.
  2. Enter an address number (example, 1). Use an address number that has data in V0101B.
  3. Click Run.
  4. The output should show results for the address number that you entered.

  5. Change the number and run it again to see different results.
    External REST to AIS Orchestration Test
  6. Click X to close the Run Orchestrations window.

section 5Using the REST Connector Output in a Subsequent Orchestration Step

In this task, you will add a new data request to the orchestration. You will use the values that you returned from in the REST connector as the input to this data request. Specifically, the REST connector is configured to return the city and state of a user. The data request will use these values as filters to find and return the zip code of the given user.

  1. In the External REST to AIS orchestration that you just tested in the previous exercise, double-click the line in the diagram after the existing connector step. Select Data Request.
  2. Data Request Step
  3. Click New.
  4. On the Data Request design page, complete these fields:
    • Name = Get Zip Code
    • Enter Short Description = Retrieve zip code for address book number from F0117.
  5. Click the Product Code drop-down list and select a customer product code, 55-59.
  6. In the Table/View Name field, enter F0117 and click Load.
  7. To configure the data request to filter on City and State, in the Fields grid, click the Filter icon next to these fields.

    City

    CTY1

    ST

    ADDS


  8. To specify the field that contains the data you want returned by the data request, in the Fields grid, click the Return icon next to the Postal Code (ADZ1) field.
    The system adds the field to the Return Fields and Variable Names section on the right.
    Get Zip Code Data Request
  9. Save the data request and click X to close it.
  10. Back in the orchestration, the Get Zip Code data request will be added to the diagram.
  11. Click the data request step and select Transformations.
    ■ For the City 1 input, click the Available Values drop-down list and select City under Get Address Book Records.
    ■ For the ST 1 input, click the Available Values drop-down list and select State under Get Address Book Records.
    Orchestration with the Get Zip Code Data Request - Transformations
  12. Save the orchestration.
  13. Click the End node and select Outputs and Assertions.
  14. Enable the Select option for the Postal Code. Do not enable Return All Grid Rows as we only want the first postal code that is found. The outputs should look like this: .
  15. Orchestration Output
  16. Save the orchestration.


section 6Retesting the Orchestration

  1. Double-click the Start node of the orchestration. Alternatively, you can click the Tools menu and select Run Orchestration. The orchestration will already be selected for you.
  2. Enter an address number (for example, 1). Use an address number that has data in V0101B with a city and state that are in F0117.
  3. Click Run.

    The output should show the results, including Postal Code, fetched in the second step (data request step) in the orchestration.
    Run Orchestrations Window

section 7Creating an Open API Connection to the External AIS Server

For this example, you can configure the connection to access the AIS Server Open API descriptor. You will call the same API, but you will not necessarily need to rely on the documentation because the descriptor will populate the request for you.

  1. On the Orchestrator Studio Home page, click the Connections icon.
    Alternatively, you can click the Tools menu and select Connections.
  2. Click the New button and select Open API.
  3. On Connection Information, complete these fields:
    • Name = EXTERNALAISOPEN
    • Description = External AIS Open API Call
  4. On the Service Information tab, in the Endpoint field, enter the URL for accessing the AIS REST services: https://<youraisserver:port>/jderest/swagger.json
  5. On the Security tab, select Basic Authentication, and then complete these fields to enable access to the external service:
    • User = Enter an EnterpriseOne user authorized to access the V0101B business view in the EnterpriseOne Data Browser.
    • Password = Enter the password for the EnterpriseOne user.

    Note: Again, for this example, the external resource is REST service on the AIS Server, which is used to retrieve data from EnterpriseOne. In the next task, you will create a connector that uses this connection to the REST service to retrieve data from the V0101B business view in EnterpriseOne. Therefore, the connection must include EnterpriseOne user credentials authorized to view the data for the specified business view in the EnterpriseOne Data Browser.
  6. In the Proxy tab, enter the proxy information if necessary for your network configuration. This is more probable if you are connecting to a third-party service.
  7. Save the record.
  8. Verify that the Endpoint drop-down list is populated with the service endpoint (defined in the Open API descriptor). If multiple endpoints are available, you can select the specific one to use for this connector.
  9. Service Information Tab

section 8Creating the Open API Connector

In this task, you will create a connector to call a REST service.

  1. On the Orchestrator Studio Home page, click the Connectors icon.
  2. Click the New button and select Open API.
  3. On the Connector page, complete the following fields:
    • Name = Get Address Book Records Open API
    • Enter Short Description = Retrieve address book records from the external AIS Server 
  4. Click the Product Code drop-down list and select 55 for the customer product code.
  5. In the Open API drop-down list, select the EXTERNALAISOPEN connection, which you created in the previous task.
  6. Notice that the API drop-down list contains all of the services described in the Open API/Swagger descriptor.
  7. Select /v2/dataservice/view. This is the same service you manually entered in the previous exercises.
  8. API Summary
  9. Notice that selecting the API you want to use automatically populates the HTTP Method. In this example, the value is GET.
  10. Expand the Pathing section and in the Value grid, verify that the full path is already populated with a variable defined for the view name parameter in the path.
  11. Expand the Parameters section. Delete all parameters except for the $filter parameter. All of them are displayed because they are all possible defined inputs, but you will only be using one in this example.
  12. Change the Value for the $filter parameter:
    $filter = F0101.AN8 EQ ${AddressNumber}
    This parameter enables you to filter the data, requesting the record with AN8 matching the input variable AddressNumber.
  13. Click here to review the output for this API, which you will refine in the next step.
  14. Expand the Headers section. Delete all but the Accept key here; you don’t need to use these for this request, but they are defined in the descriptor, so you know they are available.
  15. To limit the output to a few returned values, expand the Response section and the Output section.
  16. Enter the following output values in the JSON table:
    Output
    Variable Name
    fs_DATABROWSE_V0101B.data.gridData.rowset[0].F0101_ALPH Name
    fs_DATABROWSE_V0101B.data.gridData.rowset[0].F0101_AT1 Type
    fs_DATABROWSE_V0101B.data.gridData.rowset[0].F0116_CTY1    City
    fs_DATABROWSE_V0101B.data.gridData.rowset[0].F0116_ADDS    State
  17. Save the connector.
  18. To test the service call, click the Test button, enter viewName V0101B, address number 1, and click Execute.
  19. First you will see the response directly from the service. Make sure you receive the expected output of one record for address 1.
  20. Click the Show Output button and make sure you receive only the four pathed items you entered.
  21. Response
  22. Close the test window.

section 8Creating and Testing the Open API Orchestration

  1. In the new Open API connector window, click Manage, and click Create Orchestration.
  2. Save the orchestration as it was automatically created.
  3. Click the Start node and select Inputs and Values.
    • Enter 1 for in the Default Value  field of AddressNumber.
    • Enter V0101B in the Default Value field of viewName.
    Inputs and Values Window
  4. Click the End node and click Output and Assertions. In the Output column, rename the four outputs with these simple names:
    • Name
    • Type
    • City
    • State
  5. Save the changes to the orchestration.
  6. Double-click the Start node of the orchestration. Alternatively, you can use click Tools and click the Run Orchestration menu.
  7. The orchestration will already be selected for you. Notice that the default values are also displayed.
  8. Click Run.
  9. Run Orchestrations Window

more informationWant to Learn More?