Using JSDOs to create mobile and web clients : JSDO overview : Requirements for using a JSDO
  

Requirements for using a JSDO

The basic requirements for using a JSDO include having network access to the Data Object resources that it reads and writes and setting up a JSDO login session to access these Data Object resources.
To use a JSDO in a mobile or web app, you need to ensure that the following actions have been completed:
1. Obtain the URI for the Data Object Service location (web application) and also the Data Service Catalog that supports each Data Object resource you want to access. For more information on supported Data Object Services and how to obtain location information for them, see App development options.
2. Create and initialize a JSDO login session between your mobile or web app and the specified web application. The standard way you can do this is to invoke the stand-alone function, progress.data.getSession( ) (available in Progress Data Objects Version 4.3 or later), which returns a jQuery Promise for you to handle the associated network requests asynchronously.
Note: You can call this function as many times as required to create and initialize separate login sessions for additional web applications that host Data Object Services you need to access using a JSDO.
This function combines the work of the following login session actions and methods:
a. Creates an instance of the progress.data.JSDOSession class, which encapsulates the login session and supports asynchronous request management of the session using jQuery Promises as well as named events. You must ensure that you initialize the login session to use the same authentication model as the specified web application. For more information on coding for security considerations such as the web server authentication model, see Managing JSDO login sessions.
b. Calls the login( ) method on the JSDOSession object with any credentials you pass to getSession( ) in order to establish the login session for the specified web application.
c. Assuming that the login session is successfully established, the function calls the addCatalog( ) method on the object to load the Data Service Catalog you have specified for a given Data Object Service. For more information, see Managing JSDO login sessions.
3. Once getSession( ) successfully executes and initializes the login session with the specified Data Service Catalog, you can instantiate a progress.data.JSDO class to create the JSDO for any supported Data Object resource you need to access. For more information, see Creating and managing access to a JSDO instance.
Note: You can call addCatalog( ) on the JSDOSession object returned by getSession( ) in order to initialize the login session for additional Data Object Services supported by the same web application. Whether or not you initialize an existing login session to access additional Data Object Services, you must instantiate a separate JSDO for each Data Object resource you want to access.
Note: You can also create a JSDOSession by manually instantiating the progress.data.JSDOSession class. In this case, you must also manually invoke login( ) and addCatalog( ) on the JSDOSession instance before creating an associated JSDO.
4. With a JSDO instance, you can read, update, and write resource data, or execute resource business logic, as defined for the Data Object resource for which you have created the instance. For more information, see Accessing standard CRUD and Submit operations and Accessing custom Invoke operations.
5. Once your mobile or web app is done with its JSDO instances and no longer needs access to the login sessions you have created using the getSession( ) stand-alone function, you can terminate and invalidate access to all of them by invoking the the stand-alone function, progress.data.invalidateAllSessions( ) (available in Progress Data Objects Version 4.4.1 or later). This function invokes the invalidate( ) method on each JSDOSession object that is created and initialized in the app. The invalidate( ) method, in turn, both invokes the logout( ) method to terminate the associated login session and renders its JSDOSession object permanently unavailable (invalidates it) from creating additional login sessions using its login( ) method. For more information, see Creating and managing access to a JSDO instance.
Note: You can invalidate multiple JSDOSession instances using invalidateAllSessions( ) only if they were all created using the getSession( ) stand-alone function. For any JSDOSession objects that you instantiate manually, you can only log them out or invalidate them permanently by calling logout( ) or invalidate( ) on each such JSDOSession instance manually.
Note: For some applications, instead of invoking the stand-alone invalidateAllSessions( ) function, you might want to manually invoke either the invalidate( ) method or the logout( ) method on each JSDOSession object whose login session you want to terminate. For more information, see the notes on the progress.data.JSDOSession class.
For more information on the stand-alone functions for use with the JSDO framework, see the descriptions of the getSession( ) stand-alone function and invalidateAllSessions( ) stand-alone function.