Skip to content

Latest commit

 

History

History
95 lines (63 loc) · 2.88 KB

File metadata and controls

95 lines (63 loc) · 2.88 KB
Level Technologies Target Product Product Versions Source

Beginners

Teiid, WS Translator

DV

DV 6.2

https://github.com/teiid/teiid-quickstarts

What is it?

The 'socialMedia-as-a-datasource' demonstrates using the WS Translator to call secured rest service Twitter, and transform the web service results into relational results.

System requirements

Setup

In this section, we will demonstrate how to use Teiid WS Translator query all tweets you have posted over the years. Using the following steps to execute a query:

1. Setup the Twitter Apps

Login to https://apps.twitter.com/ with your Twitter Account, create a Twitter Apps.

2. Create a Security Domain

Twitter use OAuth authentication, run teiid-oauth-util.sh utility:

$ ./bin/teiid-oauth-util.sh

will generate a security-domain xml configuration. Add the security domain to your standalone-teiid.xml file in security-domains subsystem.

3. Start the server

To start the server, open a command line and navigate to the "bin" directory under the root directory of the Teiid server and run:

./standalone.sh //For Linux
standalone.bat //for Windows

If Teiid isn’t configured in the default configuration, append the following arguments to the command to specify the configuration -c {configuration.file}

Example
./standalone.sh -c standalone-teiid.xml

4. Setup ws resource adapter

Install the Customer web service datasource to be referenced by the Teiid VDB, run the following CLI script

cd $\{JBOSS_HOME}/bin
./jboss-cli.sh --connect --file={path}/twitter-as-a-datasource/src/scripts/setup.cli

5. VDB Deployment

Copy the following files to the "/standalone/deployments" directory

src/vdb/twitter-vdb.xml
src/vdb/twitter-vdb.xml.dodeploy

Open the admin console(http://localhost:9990/console) to make sure the VDB is deployed. See Query Demonstrations below to demonstrate query.

Query Demonstrations

  1. Change your working directory to "${quickstart.install.dir}/simpleclient"

  2. Use the simpleclient example to run the following queries:

Example: mvn exec:java -Dvdb="twitter" -Dsql="example query" -Dusername="xx" -Dpassword="xx"

NOTE - depending on your OS/Shell the quoting/escaping required to run the example can be complicated. It would be better to install a Java client, such as SQuirreL, to run the queries below.

Example of query Twitter tweets
select * from TwitterUserTimelineView