You are on page 1of 23

ODI 12.2.

1: REST 11/27/17, 8(40 AM

ODI 12.2.1: Integrating RESTful Services

Before You Begin

Purpose

In this tutorial you learn about the RESTful service support available in Oracle Data Integrator (ODI)
12.2.1.2.6.

Time to Complete

Approximately 40 minutes

Background

ODI 12.2.1.2.6 supports RESTful services invocation for reading or writing data. The RESTful endpoints can
be configured like any other data server in topology and can be easily invoked through an ODI tool in the
integration flow.

Scenario

In this example, you will query Google's financial services website from ODI to return the stock prices of
various companies to json files.

What Do You Need?


Completion of Oracle Data Integrator 12c: Integration and Administration
(http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?
page_id=609&p_org_id=1001&lang=US&get_params=dc:D82167GC10,p_preview:N) training or equivalent
experience
Oracle Data Integrator Getting Started Virtual Machine
(http://www.oracle.com/technetwork/middleware/data-integrator/odi-demo-2032565.html) (contains all
preinstalled software and artifacts)

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 1 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

A minimum of 6 GB RAM

Starting ODI 12.2.1

1. On your desktop, double-click ODI 12c Beta.

Description of this image (files/REST_001.txt)

2. In ODI, click Connect to Repository.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 2 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_002.txt)

3. In the Oracle Data Integrator Login dialog box, enter the following values and then click OK..

Login Name: Cubes Dimensions Lab


User: SUPERVISOR
Password: welcome1

Description of this image (files/REST_003.txt)

The user and password is prepopulated from the wallet. If you're asked for the wallet password, enter
welcome1.

Creating Topology Configurations

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 3 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Defining the RESTful Service

1. In the Topology tab, expand Physical Architecture and Technologies, then right-click Restful Services
and select New Data Server.

Description of this image (files/REST_004.txt)

2. In the New Object form, complete the following fields:

Name: GoogleFinanceRestService
REST Service Endpoint URL: http://finance.google.com

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 4 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_005.txt)

3. In the ODI toolbar, click Save, then click OK in the Information dialog. Click Test Connection, then OK in
the Information dialog.

Description of this image (files/REST_006.txt)

If the test is successful, you can close the GoogleFinanceRestService tab. If it was unsuccessful, you
need to modify ODI's connection to the Internet. Click Tools/Preferences menu item, then in the
Preference dialog box, click Web Browser and Proxy, select Proxy Settings tab and alter your settings.

4. In the Topology tab, under Physical Architecture and Technologies, expand RESTful Service, right-
click GoogleFinanceRestService and select New Physical Schema from the menu.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 5 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_007.txt)

5. In the GoogleFinanceRest Service Resource URI form, enter /finance in the Resource URI field. Note
that the URI gets appended to the Name.

Description of this image (files/REST_008.txt)

6. Switch to the Operations tab. Click Add Operation and set the following parameter values:

Name: getQuote
Method: GET
Operation URI: info
Query Parameter: Click ..., then click Add Parameter in the Edit Query Parameters dialog window, and
add the following parameters:
Name Value

client q

q NASDAQ:ORCL

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 6 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_009.txt)

Click OK to dismiss the Edit Query Parameters dialog box.

7. In the ODI toolbar, click Save. Click OK to dismiss the Information dialog box.

8. Switch to the Context tab. Click Add to add a Context. Enter the following:

Context: Global
Logical Schema: google-finance-get-quote

Description of this image (files/REST_010.txt)

9. In the ODI toolbar, click Save, then close GoogleFinanceRest Service Resource URI.

Using the REST Tool Invocation to get json response

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 7 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

1. In the Designer tab, expand Projects, right-click Beta and select New Folder.

Description of this image (files/REST_011.txt)

2. In the New Object form, enter Rest Tool Invocation in the Name field, then click Save in the ODI
toolbar. Close the Rest Tool Invocation tab.

Description of this image (files/REST_012.txt)

3. In the Designer tab, under Projects, expand Beta and Rest Tool Invocation, then right-click Packages
and select New Package.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 8 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_013.txt)

4. In the New dialog box, enter PkgGetQuote in the Name field, a suitable description in the Description
field, then click OK.

Description of this image (files/REST_014.txt)

5. From Toolbox pane, select OdiInvokeRESTfulService, then click a space in the Package map area to
add it as a step to the package. Make sure it is defined as the first step in the package. Right click it and
in the resulting menu, see that First Step is selected. If not, select it.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 9 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_015.txt)

6. Enter the following parameter values in the Properties pane.

Context: Global
Logical Schema: google-finance-get-quote
Main Operation: getQuote
Response File: <vm_file_path>/getQuoteORCL.json
Append to Response File: No
Trace File: <vm_file_path>/getQuoteTraceORCL.txt
Append to Trace File: No

For <vm_file_path>, enter a location on your machine where the response files will be saved.

You can always test the service by clicking Test Restful Service button.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 10 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_016.txt)

7. From Toolbox, add another OdiInvokeRESTfulService step into the Package map area, then enter the
following parameter values:

Context: Global
Logical Schema: google-finance-get-quote
Main Operation: getQuote
Response File: <vm_file_path>/getQuoteAAPL.xml
Append to Response File: No
Trace File: <vm_file_path>/getQuoteTraceAAPL.txt
Append to Trace File: No

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 11 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Click Request Query tool parameter, and set q: NASDAQ:AAPL

For <vm_file_path>, enter a location on your machine where the response files will be saved.

Description of this image (files/REST_017.txt)

8. Click Next step on success. Click on the first OdiInvokeRESTfulService and drag the cursor to the
second one. This create a link between the two.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 12 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_018.txt)

9. In the ODI toolbar, click Save, then click Run. Click OK in the Run dialog window, and again in the
Information dialog window. Confirm the response and status files have been correctly created.

Description of this image (files/REST_019.txt)

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 13 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_020.txt)

10. Close PkgGetQuote.

Using Template Parameters

The following sections illustrate how to use parameters with the REST tool.

Creating an Operation With Parameters

1. In the Topology tab, expand Technologies, RESTful Service and GoogleFinanceRestService, then
double-click GoogleFinanceRestService./finance.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 14 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_021.txt)

2. In the GoogleFinanceRestService./finance page, switch to the Operations tab, then click Add
Operation and add the following:

Name: getQuoteUsingTemplateParams
Method: GET
Query Parameter: Click ..., then click Add Parameter in the Edit Query Parameters dialog window, and
add the following parameters:

Name Value

client q

q #[symbol#}

Template Parameter: Click ... and enter ORCL in the Value field for symbol.

Description of this image (files/REST_022.txt)

3. In the ODI toolbar, click Save, then close GoogleFinanceRestService./webservice/v1/symbols/.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 15 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Using the REST Tool Invocation to get json/xml Response

1. Switch to the Designer tab and expand Projects, Beta, right-click Variables and select New Variable.

Description of this image (files/REST_023.txt)

2. In the New Object form, enter var_symbol in the Name field and select Text for Datatype.

Description of this image (files/REST_024.txt)

3. In the ODI toolbar, click Save, then close var_symbol.

4. In the Designer tab, under Projects and Beta, expand Rest Tool Invocation, right-click Packages and
then select New Packages.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 16 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_025.txt)

5. In the New dialog window, enter PkgGetQuoteUsingVariables in the Name field, enter a suitable
description in the Description field, and then click OK.

Description of this image (files/REST_026.txt)

6. In the Toolbox pane, select OdiInvokeRESTfulService, then click in the Package mapping area to add it
as the first step.

7. Set the following parameter values in the Properties pane below for OdiInvokeRESTfulService1:

Context: Global
Logical Schema: google-finance-get-quote

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 17 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Main Operation: getQuoteUsingTemplateParams


Request Template: Click ... then set the value for symbol AAPL , then click OK.
Response File: <vm_file_path>/getQuote_AAPL.json
Append to Response File: No
Trace File: <vm_file_path>/getQuote-TRACE_AAPL.txt
Append to Trace File: No

For <vm_file_path>, enter a location on your machine where the response files will be saved.

Description of this image (files/REST_027.txt)

8. From the Designer tab, under Projects, Beta, Variables, drag and drop var_symbol into the
PkgGetQuoteUsingVariables package map, then set the following parameter values:

Type: Set Variable

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 18 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Value: GOOG

Description of this image (files/REST_028.txt)

9. In the Package toolbar, click Next step on Success, then click odiInvokeRESTfulService1 and drag
your cursor to var_symbol, creating a link between the two steps.

Description of this image (files/REST_029.txt)

10. From the Toolbox pane, select OdiInvokeRESTfulService, then click in the package map area to add it
as the third step. Set the following parameter values:

Context: Global
Logical Schema: google-finance-get-quote
Main Operation: getQuoteUsingTemplateparams
Response File: <vm_file_path>/getQuote_GOOG.json
Append to Response File: No
Trace File: <vm_file_path>/getQuoteTraceGOOG.txt
Append to Trace File: No

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 19 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Click RequestTemplate tool parameter and set Symbol: #var_symbol

For <vm_file_path>, enter a location on your machine where the response files will be saved.

Description of this image (files/REST_030.txt)

11. In the Package toolbar, click Next Step on Success, then click var_symbol step and drag the cursor to
the OdiInvokeRESTfulSerive2 step, creating a link between the two steps.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 20 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_031.txt)

12. In the ODI toolbar, click Save, then click Run. Click OK in the Run dialog window, and again in the
Information dialog window. Verify that the session ran successfully and that the response and status files
were created properly. Note that the template parameter was substituted with variable value during
execution.

Description of this image (files/REST_032.txt)

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 21 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Description of this image (files/REST_033.txt)

Want to Learn More?

Credits

Lead Developers: Ian Bristow, Jenny Chan

Other Contributors: Julien Testut, Ayush Ganeriwal

Resources

You can read more about Oracle Data Integrator 12.2.1.2.6 with our documentation
(http://docs.oracle.com/middleware/122126/odi/index.html).

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 22 of 23
ODI 12.2.1: REST 11/27/17, 8(40 AM

Download ODI from Oracle Technology Network (http://www.oracle.com/technetwork/middleware/data-


integrator/overview/index.html) to evaluate it. There are also links to white papers, videos and webcast
recordings.

More OBEs for ODI are available from the Oracle Learning Library (https://apexapps.oracle.com/pls/apex/f?
About Oracle (http://www.oracle.com/corporate/index.html) Contact Us (http://www.oracle.com/us/corporate/contact/index.html)
Legal Notices (http://www.oracle.com/us/legal/index.html) Terms of Use (http://www.oracle.com/us/legal/terms/index.html)
Your Privacy Rights (http://www.oracle.com/us/legal/privacy/index.html)
Copyright 2015, Oracle and/or its aliates. All rights reserved.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_12c/odi_12.2.1.1/Integrating_RESTful_Services/ODI_12_2_1_REST.html Page 23 of 23

You might also like