-
30. Re: 401 Unauthorized in REST Web Service Source
shawkins Oct 30, 2017 2:04 PM (in response to blafond)[TEIID-5130] Document/refine behavior of treating result parameter as the first parameter - JBoss Issue Tracker addresses this from the Teiid side, but it will make some DDL from Designer invalid.
-
31. Re: 401 Unauthorized in REST Web Service Source
vijayjose Oct 31, 2017 5:10 AM (in response to shawkins)Steven,
> change the web service physical model invokeHttp procedure in designer so that the result is the first parameter.
I got syntax error on doing this.Can you please provide an example.
-
32. Re: 401 Unauthorized in REST Web Service Source
shawkins Oct 31, 2017 8:08 AM (in response to vijayjose)Import the attached DDL to replace the definition of your source invokeHttp. This puts the result parameter as the first in the arguments. Unfortunately there isn't an easy editing action to simply reorder the parameter list.
-
SourceModel.ddl.zip 307 bytes
-
-
33. Re: 401 Unauthorized in REST Web Service Source
vijayjose Oct 31, 2017 8:49 AM (in response to shawkins) -
34. Re: 401 Unauthorized in REST Web Service Source
vijayjose Oct 31, 2017 9:04 AM (in response to vijayjose)Steven,
{
"userSettings": {
"userName": " ",
"password":" "
}
}
If this is the format of parametres of POST method.
How can i add this
-
35. Re: 401 Unauthorized in REST Web Service Source
rareddy Oct 31, 2017 9:52 AM (in response to vijayjose)jsonObject(jsonObject('user' as userName, 'password' as password) as userSettings)
-
36. Re: 401 Unauthorized in REST Web Service Source
shawkins Oct 31, 2017 9:54 AM (in response to vijayjose)> If this is the format of parametres of POST method.
Meaning that is payload sent as part of the request?
You would change the action to POST and set the request parameter to the json value, similar to:
request=>jsonObject(jsonObject(name as "userName", password as "password") as "userSettings")
Where name and password would be expressions that evaluate to what you want to pass.
-
37. Re: 401 Unauthorized in REST Web Service Source
vijayjose Nov 1, 2017 9:11 AM (in response to shawkins) -
38. Re: 401 Unauthorized in REST Web Service Source
rareddy Nov 1, 2017 11:27 AM (in response to vijayjose)See examples here. JSON Functions · Teiid Documentation
Even the above JSON fragment Steve and I provided above is good an example to start with.
-
39. Re: 401 Unauthorized in REST Web Service Source
vijayjose Nov 2, 2017 9:05 AM (in response to rareddy)When adding a connection url an extra '/' is automatically adding at the end at the time of execution.
eg:
https:/example.com/files?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
then it is automatically changing to
https:/example.com/files/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
And when ever i am trying to add a parameter then,
the source model of the generating procedure is empty
the procedure is :
BEGIN
DECLARE STRING VARIABLES.qp = QUERYSTRING('https://apidocs.zoho.com/files/v1/folders', ViewModel_2.test.scope AS scope, || '/' || ViewModel_2.test.scopeViewModel_2.test.authtoken AS authtoken || '/' || ViewModel_2.test.authtoken);
SELECT
A.response AS response
FROM
(EXEC SourceModel_1.invokeHttp(action=>'GET',endpoint=>VARIABLES.qp,stream=>'TRUE')) AS f, XMLTABLE('/response' PASSING JSONTOXML('response', f.result) COLUMNS response string PATH 'text()') AS A;
END
and the error showing is :
ERROR: Error in parsing of sql - Encountered " "||" "|| "" at line 2, column 130.:
-
40. Re: 401 Unauthorized in REST Web Service Source
shawkins Nov 2, 2017 1:16 PM (in response to vijayjose)> When adding a connection url an extra '/' is automatically adding at the end at the time of execution.
It could be a copy paste error, but the two urls you show look identical. Presumably you mean that you see ?token=value/
That doesn't seem expected. Can you provide the full details of what you have set on your resource adapter and what you are passing in on the invokeHttp function?
> ERROR: Error in parsing of sql - Encountered " "||" "|| "" at line 2, column 130.:
It appears that you are missing a comma between "authtoken ||"
Do you mean to append a slash? Something like "|| '/' || ViewModel_2.test.scopeViewModel_2.test.authtoken AS authtoken" becomes:
authToken=%2Fvalue
-
41. Re: 401 Unauthorized in REST Web Service Source
vijayjose Nov 3, 2017 12:36 AM (in response to shawkins)steven,
DECLARE STRING VARIABLES.qp = QUERYSTRING('https://apidocs.zoho.com/files/v1/folders', ViewModel_2.test.scope AS scope, || '/' || ViewModel_2.test.scopeViewModel_2.test.authtoken AS authtoken || '/' || ViewModel_2.test.authtoken);
The BOLD letters were additional,dont know how it is generated,deleting that fix the problem and after that source model appears.
-
42. Re: 401 Unauthorized in REST Web Service Source
vijayjose Nov 3, 2017 9:16 AM (in response to shawkins) -
43. Re: 401 Unauthorized in REST Web Service Source
shawkins Nov 3, 2017 2:18 PM (in response to vijayjose)The XMLTALBE constructs supports array columns and you can return a whole xml subtree
Array:
select * from xmltable('/a' passing convert('<a><b>first</b><b>second</b></a>', xml) columns x string[] path 'b') as x;
XML
select * from xmltable('/a' passing convert('<a><b>first</b><b>second</b></a>', xml) columns x xml path '.') as x;
-
44. Re: 401 Unauthorized in REST Web Service Source
vijayjose Nov 6, 2017 8:17 AM (in response to shawkins)Steven,
tried this
I took
a as the response
b as the json array
first,second as the fields in json array
But getting error here--'<a><b>first</b><b>second</b></a>'
What is the 'x' before string []