Code generation do not generate right code for service
Code generation do not generate right code for service in my Project "Mark Lock"
any problem out there?
Thanks in advance
Luca
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Code generation do not generate right code for service in my Project "Mark Lock"
any problem out there?
Thanks in advance
Luca
Hi, now it generate the right code ...
Its a: "Now OK, later KO, Now OK, ..." intermittent error behavior ...
Hello Luca!
Please share public link (go Test- check Public- copy URL) and tell where do you get code generation error (you can send link to a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a).
Also provide more details such as what changes in builder do you make before it becomes wrong again.
I think is a decode/encode problem
I got a service url that work in the gui interface in tab test and is encoded:
precode
http://query.yahooapis.com/v1/public/yql?q=select%20%20from%20html%20where%20url%3D%22http%3A%2F%2Fwww.tmview.europa.eu%2Ftmview%2FbasicSearch.html%3Fq%3Deccolo%22%20and%20xpath%3D%22%2F%2F%5Bcontains(text()%2C%20'cacheKey')%5D%22&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
/code/pre
this the decoded on just FYI
precode
http://query.yahooapis.com/v1/public/yql?q=select * from html where url="http://www.tmview.europa.eu/tmview/basicSearch.html?q={queryString}" and xpath="//*[contains(text(), 'cacheKey')]"&env=store://datatables.org/alltableswithkeys
/code/pre
but the service generated does not escape the "'" char correctly
precode class="javascript"
/*
Services
*/
var svcDef_getTMViewXML = new Appery.RestService({
'url': 'http://query.yahooapis.com/v1/public/yql?q=select%20%20from%20html%20where%20url%3D%22http%3A%2F%2Fwww.tmview.europa.eu%2Ftmview%2FbasicSearch.html%3Fq%3D{queryString}%22%20and%20xpath%3D%22%2F%2F%5Bcontains(text()%2C%20'
cacheKey ')%5D%22&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys',
'dataType': 'xml',
'type': 'get',
});
/code/pre
Luca, use this URL http://query.yahooapis.com/v1/public/yql instead.
The rest set up with Request parameters (you have q and env).
May be I do not explain the concept clearly so, in my opinion, the problem is the generation of the service; in fact the javascript object passed to "new Appery.RestService" do not escape correctly the ' char.
You can see this easily with a code highlighter editor (I have attached a picture showing that first piece of code wrong generated and the second using '' to encode correctly the string)
That's it.
Luca
Done!!
Yes, symbol ' is not allowed in url. If you need this symbol in url you should manually escape it with symbol \
For example
http://siteurl.com/?q=\'text\'
Sorry but I think that is just a work-around and not a solution; because in the gui in which I define the Service the string must be un-escaped otherwise the test do not work ... so is the code generator that have to insert the escape chars when it codes the service code.