luca.guzzon
Posts: 0
Joined: Fri Apr 19, 2013 4:47 pm

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

luca.guzzon
Posts: 0
Joined: Fri Apr 19, 2013 4:47 pm

Code generation do not generate right code for service

Hi, now it generate the right code ...

luca.guzzon
Posts: 0
Joined: Fri Apr 19, 2013 4:47 pm

Code generation do not generate right code for service

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Code generation do not generate right code for service

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.

luca.guzzon
Posts: 0
Joined: Fri Apr 19, 2013 4:47 pm

Code generation do not generate right code for service

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Code generation do not generate right code for service

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

luca.guzzon
Posts: 0
Joined: Fri Apr 19, 2013 4:47 pm

Code generation do not generate right code for service

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

Oleg Danchenkov
Posts: 0
Joined: Tue Apr 30, 2013 5:51 pm

Code generation do not generate right code for service

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

luca.guzzon
Posts: 0
Joined: Fri Apr 19, 2013 4:47 pm

Code generation do not generate right code for service

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.

Return to “Issues”