Permalink
Fetching contributors…
Cannot retrieve contributors at this time
92 lines (60 sloc) 2.9 KB

webservices-as-a-datasource Quickstart

Level Technologies Target Product Product Versions Source

Beginners

Teiid, WS Translator

DV

DV 6.0+

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

What is it?

webservices-as-a-datasource demonstrates using the WS Translator to call a web services and transform the web service results into relational results.

The CustomerRESTWebSvc war will be deployed and accessed as a data source using the WS Translator. This war contains customer information, so that no external web service is required in order to demonstrate the WS feature.

System requirements

mvn clean compile war:war

Setup and Deployment

1. Start the server (if not already started)

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

2. Deploy the war

Deploy the war file that will be used as the web service resource to be accessed as a data source by Teiid

  • copy the target/CustomerRESTWebSvc.war to the /standalone/deployments directory

  • Test the war by opening a browser at the following URL:

3. 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}/webservice-as-a-datasource/src/scripts/setup.cli

=== VDB Deployment

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

src/vdb/webservice-vdb.xml src/vdb/webservice-vdb.xml.dodeploy

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

== Query Demonstrations

==== Using the simpleclient example ====

1.  Change your working directory to "${quickstart.install.dir}/simpleclient"
2.  Use the simpleclient example to run the following queries:

mvn exec:java -Dvdb="webservice" -Dsql="select * from CustomersView" -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.