This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc
Skip to end of metadata
Go to start of metadata

Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation:

  • <PRODUCT_HOME>/repository/samples/ directory that includes all Data Integration samples is changed to <EI_HOME>/samples/data-services/.
  • <PRODUCT_HOME>/repository/samples/resources/ directory that includes all artifacts related to the Data Integration samples is changed to <EI_HOME>/samples/data-services/resources/.

A data sharing format used often on the Internet is Google Spreadsheet. WSO2 Enterprise Integrator (WSO2 EI) contains support for Google Spreadsheets as a datasource.

About the sample

The spreadsheet contains data about the customers of a specific company. The GSpread sample service contains a single operation named getCustomers , which returns all the customer information that is stored in the Google spreadsheet. There is also a resource defined as customers, which can be accessed using the following URL: "http://localhost:9763/services/GSpreadSample.HTTPEndpoint/customers".

See Data integration for a definition of data services and operations.

Building the sample

The sample data service named GSpreadSample should be deployed and configured as follows:

  1. Follow the instructions in Samples Setup to have the sample deployed.
  2. Because we are using a Google spreadsheet as the datasource, we need to update the credentials for accessing the spreadsheet. This is done using a Client IDClient Secret and Refresh Token that is generated from the Google API Console. Follow the google documentation for instructions on how to get an OAuth2 client ID and client secret. In order to get these credentials, you will be asked to provide an authorization redirect URL. Be sure to use localhost as the IP in the browser redirect URL.

  3. Now you can add the credentials to the GSpreadSample data service as follows:
    1. Log in to the management console of your server using the following URL: https://localhost:8243/carbon/

      For the purpose of this sample, be sure to use localhost as the IP in the above URL.

    2. Click List under Services in the navigator. The GSpreadSample will be listed there. 
    3. Click the GSpreadSample to open the sample's dashboard.
    4. Click Edit Data Service Wizard to start editing the data service using the management console.
    5. Click Next until you reach the Datasource screen shown below.
    6. Click the GSpreadSample datasource to start editing the datasource.
    7. Note that a client ID, client secret and refresh token are specified by default. Replace the Client ID and Client Secret values using the new values you obtained in step 2 above.
    8. Click Generate Token. You will be redirected to the google consent page. After you approve that, the refresh token will be inserted into the Refresh Token field as shown below.
    9. Save the datasource. You can now run the sample as explained below.

Running the sample

The sample service can be run using the TryIt tool, which is bundled with the WSO2 Data Services Server, or a code-generated java client sample as discussed in the Data Services Clients section.

Follow the steps below to demonstrate this functionality using the TryIt tool:

  1. In the management console of your server and click List under Services in the navigator. The GSpreadSample will be listed here.
  2. Click Try this service to open the TryIt tool.
  3. Select the "getCustomers" operation and click Send to execute the request. You will get the customer details in the response as shown below.
     
  • No labels