-
1. Re: Teiid VDB with rest auto generate tag encounters two errors - war not deployed and unauthorized error
rareddy Oct 25, 2017 12:01 PM (in response to dasssri)Does the user role need to be "rest" role? If yes, how to set up the "rest" role? Teiid version is 9.3.1.
Yes, when you use the "adduser.bat" or "adduser.sh" script in the "wildfly/bin" directory to add the user and his/her credentials, there is a step in there that asks for roles, you need to add in the "rest" role.
1. On one server, the war does not generate whereas the VDB definition asks to auto generate, yet the deployment does not auto generate the war file. I do not see any error in the log file. Not sure why the war file does not generate. Teiid version is 9.3.3.
There are two different ways Teiid provides the WAR generation. 1) Though the Designer, where you need to explicitly generate a WAR file and corresponding data source with matching JNDI required and deploy the file. 2) The Auto Generated WAR file. If you are using this follow directions here [1]. Here you need to define the Metadata correctly on procedures, then you also need to set the properties in the VDB.XML file to auto-generate the WAR file when it is deployed. Even if you are using Designer, on the VDB Explorer window it provides a way to enter these properties using the UI. If you are in doubt, open the ".vdb" file with a zip utility and see in the vdb.xml file if these properties exist or not. If not go back the Designer and add the properties then regenerate the VDB before deploying. If you are using the Designer then manually add them and then deploy.
-
2. Re: Teiid VDB with rest auto generate tag encounters two errors - war not deployed and unauthorized error
dasssri Oct 25, 2017 12:19 PM (in response to rareddy)I attempted to add user. I see two realms - management and application. I guess, I choose application. Then, I see group, not role. Do I enter rest in group?
I created the xml (in previous attachment) and deployed both via placing on deployment folder as well as by deploying from command line using deploy command.
Dassri
-
3. Re: Teiid VDB with rest auto generate tag encounters two errors - war not deployed and unauthorized error
rareddy Oct 25, 2017 1:15 PM (in response to dasssri)Yes, application realm is correct. The management one is used for admin user for logging into web-console etc. Group == Role in this context.
Sorry, I did not pay attention to your VDB last time, the following line is not correct in this situation
<property name="{http://teiid.org/rest}passthrough-auth" value = "true"/>
Check the "security" section in the link I provided before for configuring HTTPBasic authentication. "passthrough-auth" is not for the top level, if got that from using Designer or seen anywhere in the docs please let me know.
-
4. Re: Teiid VDB with rest auto generate tag encounters two errors - war not deployed and unauthorized error
dasssri Oct 26, 2017 11:21 AM (in response to dasssri)Ramesh - Could you please send me a XML file with a simple VDB with REST auto generate tag to generate and deploy war. How do I reploy? Using jboss-client --connect , using deploy xml file command?
Dassri
-
5. Re: Teiid VDB with rest auto generate tag encounters two errors - war not deployed and unauthorized error
rareddy Oct 26, 2017 12:05 PM (in response to dasssri)I am referring your VDB, it is same. For deploy you can either copy into deployments folder or use command as above like
./jboss-cli.sh --connect
deploy simple-vdb.xml
Note yous VDB file needs to be in "xxx-vdb.xml" format. Not just simple.xml, but it needs to be simple-vdb.xml
-
6. Re: Teiid VDB with rest auto generate tag encounters two errors - war not deployed and unauthorized error
dasssri Oct 26, 2017 12:57 PM (in response to dasssri)Thank you for the correction on naming convention. I changed and re-deployed. It deploys the vdb, but does not generate the war file to access the web service. Would you mind to take a look at the xml and point any issues. This is the same code from the example in documentation.Code is as follows.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vdb name="simple" version="1">
<property name="{http://teiid.org/rest}auto-generate" value="true"/>
<model name="PM1">
<source name="text-connector" translator-name="loopback" />
<metadata type="DDL"><![CDATA[
CREATE FOREIGN TABLE G1 (e1 string, e2 integer);
CREATE FOREIGN TABLE G2 (e1 string, e2 integer);
]]> </metadata>
</model>
<model name="View" type ="VIRTUAL">
<metadata type="DDL"><![CDATA[
SET NAMESPACE 'http://teiid.org/rest' AS REST;
-- This procedure produces XML payload
CREATE VIRTUAL PROCEDURE g1Table(IN p2 integer) RETURNS TABLE (xml_out xml) OPTIONS (UPDATECOUNT 0, "REST:METHOD" 'GET', "REST:URI" 'g1/{p2}')
AS
BEGIN
SELECT XMLELEMENT(NAME "rows", XMLATTRIBUTES (g1Table.p2 as p2), XMLAGG(XMLELEMENT(NAME "row", XMLFOREST(e1, e2)))) AS xml_out FROM PM1.G1;
END
-- This procedure produces JSON payload
CREATE VIRTUAL PROCEDURE g2Table(IN p2 integer) RETURNS TABLE (json_out clob) OPTIONS (UPDATECOUNT 0, "REST:METHOD" 'GET', "REST:URI" 'g2/{p2}')
AS
BEGIN
SELECT JSONOBJECT(JSONARRAY_AGG(JSONOBJECT(e1, e2)) as g2) AS json_out FROM PM1.G2;
END
]]> </metadata>
</model>
</vdb>
-
7. Re: Teiid VDB with rest auto generate tag encounters two errors - war not deployed and unauthorized error
rareddy Oct 26, 2017 2:01 PM (in response to dasssri)I took the exact code above deployed to my latest Teiid Server 10.0.CR2 using jboss-cli.sh script and I see
12:57:08,870 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 6) WFLYUT0021: Registered web context: '/simple_1' for server 'default-server' 12:57:08,882 INFO [org.jboss.as.server] (Worker0_async-teiid-threads2) WFLYSRV0010: Deployed "simple_1.war" (runtime-name : "simple_1.war")
Then I issued the following on the browser http://localhost:8080/simple_1/View/g1/1
I saw
<rows p2="1"><row><e1>ABCDEFGHIJ</e1><e2>0</e2></row></rows>
-
8. Re: Teiid VDB with rest auto generate tag encounters two errors - war not deployed and unauthorized error
dasssri Oct 26, 2017 2:16 PM (in response to dasssri)It works. Thanks a lot!