Service_serviceName_JSDO is undefined.

Posted by wardcouckecac on 19-Apr-2013 03:35

I have 3 pages that were working well, and suddenly the 2nd page stopped working when testing because of "DiasMobile1Service_authenticate_user_JSDO is undefined" . I have no clue because I didn't change anything to this page, not in the UI nor in the javascript. In the 1st page I actually use this service, so it is working. But in the 2nd page I am not using this authenticate user invoke method at all, but a CRUD method of the same service.

Even if I skip the 1st page to eliminate bugs, I get the same error in the 2nd page.

This is the javascript (created by Tiggzi automatically, not mine) where the error occurs:

DiasMobile1Service_authenticate_user_AuthenticateUser = new Tiggr.JSDOInvoke({

    'service': DiasMobile1Service_authenticate_user_JSDO,

    'methodName': 'AuthenticateUser'

});

Somebody has a clue perhaps?
ps I hope the Tiggzi update will be pushed to the Progress branch soon, because all these fundamental bugs and errors are dividing my time in 10% development and 90% debugging.

All Replies

Posted by John Goodland on 19-Apr-2013 04:01

ps I hope the Tiggzi update will be pushed to the Progress branch soon, because all these fundamental bugs and errors are dividing my time in 10% development and 90% debugging.

+1

Posted by wardcouckecac on 19-Apr-2013 04:34

Found out that on my 1st page, which is working perfectly, the exact same code is occuring and works perfectly:

DiasMobile1Service_authenticate_user_AuthenticateUser = new Tiggr.JSDOInvoke({

    'service': DiasMobile1Service_authenticate_user_JSDO,

    'methodName': 'AuthenticateUser'

});

DiasMobile1Service_authenticate_user_JSDO is a variable, but i cannot see where it should be initialized. It appears only 1 time in the code... has somebody an idea?

I really have the impression that only a handful users are actually using OE mobile builder, otherwise a lot more people would post problems. For example, 3 problems that I had some weeks ago, are officially recognized as bugs by Tiggzi.
But i didn't post them here, but on the Tiggzi help forum (https://getsatisfaction.com/apperyio). There you get fast and helpful support within 15 minutes. But only for Tiggzi (now Appery.io) related problems, nothing concerning JSDO's or Progress related questions.

Posted by tyagi.ankit40 on 19-Apr-2013 04:39

i dont know much of this but i think i had the same problem. try, adding jsdo on 2nd page too and that might solve the issue(dont know if you should invoke jsdo service or not). now, Tiggzi i.e. apperyio pepole are also asking me to contact progress support and not helping.

Posted by egarcia on 19-Apr-2013 04:42

Hello,

Could you check if the Render all pages in one HTML file option in the App settings is unchecked?

When this option is unchecked, the pages are separate HTML pages and JavaScript variables from one page are not available in the another.

i hope this helps.

Posted by wardcouckecac on 19-Apr-2013 04:52

I found new, a bit strange information:

This is the code I get from debugging the javascript with the browser:

WORKING PAGE:

/**********************

* SECURITY CONTEXTS  *

**********************/

/*******************************

*      SERVICE SETTINGS        *

********************************/

var DiasTestService_authenticate_user_Settings = {

    "catalogURI": "http://srvdevpsc.cac.be:8980/DiasTestService/static/mobile/DiasTestService.json",

    "serviceURI": "http://srvdevpsc.cac.be:8980/DiasTestService",

    "resourceName": "authenticate_user"

}

/*************************

*      SERVICES          *

*************************/

DiasTestService_authenticate_user_JSDO = new Tiggr.JSDO({

    'serviceSettings': DiasTestService_authenticate_user_Settings

});

DiasTestService_authenticate_user_AuthenticateUser = new Tiggr.JSDOInvoke({

    'service': DiasTestService_authenticate_user_JSDO,

    'methodName': 'AuthenticateUser'

NON WORKING PAGE:

/**********************

* SECURITY CONTEXTS  *

**********************/

/*******************************

*      SERVICE SETTINGS        *

********************************/

/*************************

*      SERVICES          *

*************************/

DiasMobile1Service_authenticate_user_AuthenticateUser = new Tiggr.JSDOInvoke({

    'service': DiasMobile1Service_authenticate_user_JSDO,

    'methodName': 'AuthenticateUser'

});

Does somebody know how I can get the "service settings" and "services" code? It's Tiggzi source, so I cannot change it directly.

Posted by tyagi.ankit40 on 19-Apr-2013 05:02

on non working page, create a service for "DiasTestService_authenticate_user_JSDO". on page load, invoke this service first. this event should fire first of all other events. it should work then.

Posted by wardcouckecac on 19-Apr-2013 05:07

Yes, but there is 1 service containing 5 exposed methods, of which authenticate_user is 1 of them. I think it is strange that i would have to add 5 JSDO's to my page, even if i used only 1. Moreover, it worked before without doing this...

Update: this is a nice one: I didn't republish my appserver, nor my restmgr (it is set to republish manually). I didn't change the client page 1 (doesn't even matter, since i didn't republish the restmgr, so the webapplicaton source is still the same) , and now I have the same error, even in my page 1, which is effectively using the authenticate_user JSDO and method and was working ok just 10 minutes ago. How is that possible...

Posted by tyagi.ankit40 on 19-Apr-2013 05:19

did you check this:

         

Apr 19, 2013 5:42 AM  in response to: W Co
Re: Service_serviceName_JSDO is undefined.

Hello,

Could you check if the Render all pages in one HTML file option in the App settings is unchecked?

When this option is unchecked, the pages are separate HTML pages and JavaScript variables from one page are not available in the another.

i hope this helps.

Posted by tyagi.ankit40 on 19-Apr-2013 05:22

seems like a bug then... this OE mobile stuff is really compliacted and far beyond expectations. LOL

Posted by wardcouckecac on 19-Apr-2013 05:31

Found the problem, but no solution.

My application:  home.html with 3 buttons. One of the buttons leads to login.html page, which uses a service to login.

In home.js , Tiggzi does all the declarations for all CRUD/INVOKE JSDO's that the service provides : DiasMobile1Service_authenticate_user_JSDO etcetera  are initialized here.

On the working login.html, the home.js is included by Tiggzi. On the non-working login.html, there is a login.js (which doesn't initialize the DiasMobile1Service_authenticate_user_JSDO), but no home.js.

So that's the answer to the question why I get the browser error "DiasMobile1Service_authenticate_user_JSDO" is undefined. It is initialized in home.js,  but home.js is not included in login.html by Tiggzi.
Or, apparently, sometimes it is included, sometimes not...

Maybe it is considering the app as a one-page app sometimes, while it is not?

Now that's annoying.

Posted by wardcouckecac on 19-Apr-2013 06:01

Has somebody from Progress a clue?

So sometimes in a page, the home.js is included. And sometimes the page gets its own .js  . In the latter case, there are declarations missing, which cause the "service_serviceMethod_JSDO is undefined" error.

Posted by tyagi.ankit40 on 19-Apr-2013 06:21

Well this is quite strange. i am sure you are doing something wrong. There should be only one js with the name of the page set as the start page in the app setting. i had Login page as my start page. in PDSOE, all i could see is login.js. all other pages' code was included in that js itself. please check your Render all pages in one HTML file (jQuery Mobile multi-page template) option in app settings and then publish the app. this is all i can suggest as OE mobile stuff behaves abnormally sometimes. i am  having so much problems using this too.

Posted by wardcouckecac on 25-Apr-2013 06:21

I managed to recreate the problem, it is a bug in the mobile app builder, Progress side not Tiggzi/Appery.

If in the mobile app builder "app settings" you deselect "Render all pages in one HTML file (jQuery Mobile multi-page template)"  AFTER you have already created JSDO services, then your app will stop working and there is nothing you can do, unless reselecting "Render all pages in one HTML file (jQuery Mobile multi-page template)".

It's because if you deselect this option, Tiggzi will create .js javascript files for each page, instead of 1 big .js for home.html.  The problem is that on these separate .js files, the service_JSDO variables are not initialized, this happens only on the homepage. So when your page (other than home.html) loads and you want to invoke a JSDO service, this will not work because there are uninitialized variables that the JSDO needs to be able to construct itself.

Can somebody tell this to Progress bug support, I don't know how to do this.

Posted by Peter Judge on 25-Apr-2013 08:03

Can somebody tell this to Progress bug support, I don't know how to do

this.

>

In Progress Developer Studio, there's an option to report a technical issue: if you right-click on a project, there's a "Report Technical Issue" option which let you report an issue.

There's also a "Contact support" link on http://www.progress.com/support/ .

-- peter

Posted by mcmann on 25-Apr-2013 08:23

This is not a bug.  If you review the debugging tips document you will see:

Getting Service Not Defined on Subsequent Pages

If you have defined a service on the start page but receive an error on the second or subsequent pages that the service variable is undefined you should check to see if the “Render all pages in one HTML page” in the App Settings is unchecked.  If the pages are separate HTML pages then the JavaScript variables are not available from one page to another.

In order to have seperate pages you will need to define the services on each page.

Posted by wardcouckecac on 25-Apr-2013 08:41

Thank you.

- Where is this "debugging tips" document please?   [EDIT: found it, it is in this forum]

- What do you mean by "define the services" on each page, and how and where to do it? I invoke the JSDO and the service on the page where I need it, and I still get the undefined variable error.

- If I uncheck the “Render all pages in one HTML page” , then the result if I do "test" in Tiggzi is indeed that the pages are seperate. BUT now the PDSOE doesn't update his source files anymore. So if I run now from within PDSOE I get the old application with 1 page containing all other pages, it doesn't update. Can you replicate this?

Posted by mcmann on 25-Apr-2013 10:02

The document is at this URL:  https://community.progress.com/community_groups/mobile/f/17/t/5975 

It is under the discussion tab.  But I have attached it to this reply

Donna

Posted by wardcouckecac on 25-Apr-2013 10:51

Thank you. Do you also have an answer to the other 2 questions please?

1) What do you mean by "define the services" on each page, and how and where to do it? I invoke the JSDO and the service on the page where I need it, and I still get the undefined variable error.

2) If I uncheck the “Render all pages in one HTML page” , then the result if I do "test" in Tiggzi is indeed that the pages are seperate. BUT now the PDSOE doesn't update his source files anymore. So if I run now from within PDSOE I get the old application with 1 page containing all other pages, it doesn't update. Can you replicate this?

Posted by mcmann on 25-Apr-2013 13:12

What I mean by defining the service is what you did for the start page.  That was done under the data tab.   For #2 there has already been a bug put in for this problem.

Donna

Posted by wardcouckecac on 29-Apr-2013 07:05

Yes, but the problem is:  if you have included 10 services on the homepage, and you want to use 1 service on another page, you have to define all 10 services on the other page, not just the one that you use. Otherwise you will have the service_...JSDO undefined on the other services, even if you don't use the service on the page itself.

Also, having to redefine all services (which includes redefining all mappings, javascript, etc. associated with the redefined services) if you chose to uncheck the "render all pages in 1 html file", looks like something really user unfriendly to say the least.

This thread is closed