Level | Technologies | Target Product | Product Versions | Source |
---|---|---|---|---|
Beginners |
Teiid, WS Translator |
DV |
DV 6.2 |
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.
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:
Login to https://apps.twitter.com/ with your Twitter Account, create a Twitter Apps.
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.
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}
./standalone.sh -c standalone-teiid.xml
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
Copy the following files to the "/standalone/deployments" directory
src/vdb/twitter-vdb.xml src/vdb/twitter-vdb.xml.dodeploy
Note
|
https://developer.jboss.org/wiki/ExposeTwitterDataInTeiidUsingOAuthAuthorization has detailed steps and instructs. |
Open the admin console(http://localhost:9990/console) to make sure the VDB is deployed. See Query Demonstrations below to demonstrate query.
-
Change your working directory to "${quickstart.install.dir}/simpleclient"
-
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.
select * from TwitterUserTimelineView