Page 1 of 2

Code generation do not generate right code for service

Posted: Thu Aug 08, 2013 8:46 pm
by luca.guzzon

Code generation do not generate right code for service in my Project "Mark Lock"
any problem out there?
Thanks in advance
Luca


Code generation do not generate right code for service

Posted: Thu Aug 08, 2013 8:51 pm
by luca.guzzon

Hi, now it generate the right code ...


Code generation do not generate right code for service

Posted: Thu Aug 08, 2013 9:03 pm
by luca.guzzon

Its a: "Now OK, later KO, Now OK, ..." intermittent error behavior ...


Code generation do not generate right code for service

Posted: Thu Aug 08, 2013 9:15 pm
by Alena Prykhodko

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.


Code generation do not generate right code for service

Posted: Thu Aug 08, 2013 9:15 pm
by luca.guzzon

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


Code generation do not generate right code for service

Posted: Thu Aug 08, 2013 9:44 pm
by Alena Prykhodko

Luca, use this URL http://query.yahooapis.com/v1/public/yql instead.
The rest set up with Request parameters (you have q and env).


Code generation do not generate right code for service

Posted: Fri Aug 09, 2013 3:05 pm
by luca.guzzon

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
Image


Code generation do not generate right code for service

Posted: Fri Aug 09, 2013 3:34 pm
by luca.guzzon

Done!!


Code generation do not generate right code for service

Posted: Fri Aug 09, 2013 3:48 pm
by Oleg Danchenkov

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\'


Code generation do not generate right code for service

Posted: Sat Aug 10, 2013 4:35 pm
by luca.guzzon

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.