Setting Up Data Services

Data Services are specialized Web Services that provide access to data in datastores, and to captured changes in these datastores. These Web Services are automatically generated by Oracle Data Integrator and deployed to a Web Services container - normally a Java application server.

In the examples below, Apache Tomcat 5.5 or Oracle Container for Java (OC4J) are used as the application server, with Apache Axis2 as the Web Services container. These examples may need to be adapted if using other Web Services containers.

Setting up Data Services involves the following stages :

  1. Setting up datastores in a Web Services container.

  2. Configuring the topology to declare the Web Services container.

  3. Setting up the model, to declare datastores and columns for Data Services.

  4. Generating, deploying and testing Data Services

Setting up datasources

Before getting started, you should already have configured your Web Services container and the application server. Refer to the respective documentation for these components for details.

The Data Services generated by Oracle Data Integrator do not contain connection information for sources and targets. Instead, they make use of datasources defined within the Web Services container or on the application server. These datasources contain connection properties required to access data, and must correspond to data servers already defined within the Oracle Data Integrator topology.

In addition, all necessary drivers for the specified datasources must be installed on the application server.

To set up a datasource:

  1. Install the driver files (.jar or .zip) for your datasource in the appropriate directory for your application server. Use /common/lib for Tomcat. Use ORACLE_HOME/j2ee/home/applib for OC4J.

  2. Create the JDBC Datasource pointing to the data server you want to access:

<Context >

    <Resource

      name="jdbc/Oracle_SRV1/Oracle/dataServices"

      type="javax.sql.DataSource"

      driverClassName="oracle.jdbc.OracleDriver"

      url="jdbc:oracle:thin:@SRV1:1521:ORA10"

      username="ODI"

      password="ODI"

      maxIdle="2"

      maxWait="-1"

      maxActive="4"/>

</Context>

  1. Make a reference to the datasource in your Web Services container's WEB-INF/web.xml file. Note that you must specify the name of the datasource in the res-ref-name tag.
    One example of referencing the datasources defined above is given below:

...

<resource-ref>

<description>Data Integrator Data Services on Oracle_SRV1</description>

<res-ref-name>jdbc/Oracle_SRV1/Oracle/dataServices</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

 

  1. Restart your Axis2 application to take the new datasources into account.

Configuring the topology

Once the Web Services container is ready, you must declare it as a data server in the topology, in order to let Oracle Data Integrator deploy Data Services on it.

Note : Be careful not to confuse the Web Services containers and the servers containing deployed data. While both are declared as data servers in Oracle Data Integrator, the former do not contain any data, and only serve to host the published Data Services.

Web Services containers declared in Oracle Data Integrator have one of three modes of deploying Web Services:

The next steps in the configuration of the Web Services container depend on the deployment mode you choose to use.

To configure the Web Services container:

  1. In Topology Manager's Physical Architecture view, select the Axis2 technology. Right-click and select Insert Dataserver.  If you are using a different Web Services container, then choose the appropriate technology instead.

  2. Fill in the following fields on the Definition tab:
  1. Click OK.
    A window will open to allow you to create a physical schema.

  2. Go to the Context tab, and define one logical schema for each context in which you will deploy the Data Services.

  3. Click OK.

Note : You only need to define one physical schema per Web Services container.

For further information about setting up the topology, refer to Creating the Topology.

Setting up the model

To configure Data Services for a model, make sure that the datastores which you wish to deploy are already correctly defined (such as by reverse-engineering) and accessible. For further information, see Creating and Reverse-engineering a Model.

Make sure that you have imported the appropriate Service Knowledge Module (SKM) into one of your projects. The SKM contains the code template from which the Data Services will be generated. For further information on importing KMs, see Importing a KM.

You may also wish to consult the section Overview of Generated Services for further information about how the properties below will affect the generated Data Services.

To set up a model to use Data Services:

  1. Open the model and go to the Services tab.

  2. On the Application Server tab, select the Web Services container that you set up earlier.

  3. Set the Namespace, which will be used in the generated WSDL.

  4. Specify the Package name, used to name the generated Java package that contains your Web Service. Generally, this is of the form com.<company name>.<project name>

  5. In the Datasource name field, copy/paste the name of the datasource that you defined for the server when setting up the datasources. This name should be prefixed by java:/comp/env/.

  6. Define the Data Service Name. Note that this name is only used for the Data Service operating at the model level. You can also define a Data Service name for each datastore - see below.

  7. Select a service knowledge module (SKM) from the list, and set its options. Refer to the description of the SKM for more information. Note that only those SKMs imported into projects appear here.

  8. Go to the Deployed Datastores tab.

  9. Select every datastore that you wish to expose as a Web Service. For each one, specify a Data Service Name and the name of the Published Entity.

  10. Click OK to save your changes.

Although not required at first, you can also fine-tune the configuration of your generated Data Services at the datastore and column level.

To configure options for Data Services at the datastore level:

  1. Open the datastore and select the Services tab.

  2. Check Deploy as Data Service if you want the datastore to be deployed.

  3. Enter the Data Service Name and the name of the Published Entity for the datastore.

  4. Click OK to save your changes.

To configure Data Service options at the column level:

You can specify the operations that will be permitted for each column. One important use of this is to lock a column against being written to via Data Services.

  1. Open the column and select the Services tab.

  2. Check the operations that you wish to allow: INSERT, UPDATE, SELECT.

  3. Click OK to save your changes.

Generating and Deploying Data Services

Generating Data Services for a model also has the effect of generating the Data Services for the individual datastores.

To generate Data Services for a datastore or model:

  1. Select the model or datastore for which you wish to generate the Data Services.

  2. Right-click, and select Generate Service.
    The generation configuration window opens.

  3. Specify the path to store the generated Data Service in. Oracle Data Integrator places the generated source code and the compiled Web Service here. This directory is a temporary location that can be deleted after generation.

  4. Specify the Context. Note that the choice of context has three effects:

  1. Choose 1 or more Generation phases. For normal deployment, all three phases should be selected. However, it may be useful to only perform the generation phase when testing new SKMs, for instance. See below for the meaning of these phases.

It is also possible to use the Generate and deploy... button on the Services tab in either the Datastore or Model window.

Note: Generating Data Services for a model generates one Data Service for the model, and an additional Data Service for each of the datastores which are enabled for publishing as such.

Phase

Description

Generation

  • Deletes everything in the directory.

  • Generates .java files using SKM.

Compilation

  • Extracts Web Service framework.

  • Compiles .java files into .class files.

Deployment

  • Generates a Java package (.aar) from compiled files.

  • Copies package to deployment target, using chosen deployment method.

Overview of Generated Services

Model-level services

Data Services are only generated at the model-level when the model is enabled for consistent set CDC. The following services are generated:

See Change Data Capture for more information on these operations.

Datastore-level services

The range of operations offered by each generated Data Service depends on the SKM used to generate it. There are several common properties shared by the SKMs currently supplied by Oracle Data Integrator. In almost every case the name of the published entity forms part of the name of each operation. In the following examples, the published entity "Customer" will be used.

Testing Data Services

The easiest way to test generated Data Services is to use the graphical interface for the SnpsInvokeWebService Oracle Data Integrator tool. See also Invoking a Web Service for more information.