Level | Technologies | Target Product | Product Versions | Source |
---|---|---|---|---|
Beginners |
Teiid, WS Translator |
DV |
DV 6.0+ |
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.
-
CustomerRESTWebSvc war - Run the maven build to compile and create the web service war.
mvn clean compile war:war
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
Deploy the war file that will be used as the web service resource to be accessed as a data source by Teiid
Execute the following to deploy the war to the running server:
mvn wildfly:deploy
If you wish to manually deploy the war, do the following:
-
copy the target/CustomerRESTWebSvc.war to the /standalone/deployments directory
-
Test the war by opening a browser at the following URL:
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 queries.