01.06.2013 Views

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

services property<br />

services property<br />

Returns an array of objects that identifies the <strong>Mobile</strong> services that have been loaded<br />

for the current Session object and its <strong>Mobile</strong> Web application.<br />

Data type: Object array<br />

Access: Read-only<br />

Applies to: progress.data.Session class<br />

You load <strong>Mobile</strong> services for a Session object by loading the corresponding JSDO<br />

catalogs using the addCatalog( ) method after you login using the login( ) method.<br />

Each object in the array contains two properties:<br />

• name — The name of a <strong>Mobile</strong> service<br />

• uri — The URI for the service. If the address of the service in the catalog is an<br />

absolute URI, this value is that URI. If the service address is relative, this value is<br />

the relative address concatenated to the value of the Session object's<br />

serviceURI property, which contains the <strong>Mobile</strong> Web application URI passed to<br />

the login( ) method.<br />

Given the following service names and URIs loaded for a Session object:<br />

• "CustomerSvc" service with this URI:<br />

"/rest/CustomerSvc"<br />

• "ItemSvc" service with this URI:<br />

"http://itemhost:8080/SportsApp/rest/ItemSvc"<br />

The following code fragment produces the output that follows:<br />

// create Session<br />

pdsession = new progress.data.Session();<br />

// log in<br />

pdsession.login('/SportsApp');<br />

// load 2 catalogs<br />

pdsession.addCatalog ("/SportsApp/static/mobile/CustomerSvc.json");<br />

pdsession.addCatalog ("/SportsApp/static/mobile/ItemSvc.json");<br />

// Use services property to print services loaded by this Session object<br />

for (var i=0; i < pdsession.services.length; i++) {<br />

console.log( pdsession.services[i].name + " " +<br />

pdsession.services[i].uri);<br />

}<br />

Output from the preceding code fragment:<br />

CustomerSvc /SportsApp/rest/CustomerSvc<br />

ItemSvc http://itemhost:8080/SportsApp/rest/ItemSvc<br />

<strong>OpenEdge</strong> ® <strong>Development</strong>: <strong>Mobile</strong> <strong>Applications</strong> 243

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!