Simple way to consume a restful service in ADF Mobile is to create a URL Service Data Control.
I have created two applications. The first one RestServices.rar is a simple restful service which does a begins with search of Employees. The second one RedStackMobileRestfulDemo.rar is a ADF mobile application to consume the restful service.
First I create an XSD locally in the project to represent the response. We can also refer this remotely. But this will cause the mobile application to make a call every time the application runs.
Employees.xsd
<?xml version="1.0" encoding="windows-1252" ?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="employees">
<xs:complexType>
<xs:sequence>
<xs:element name="employee" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="department"/>
<xs:element type="xs:byte" name="employeeId"/>
<xs:element type="xs:string" name="name"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
We can now create a URL Service Data Control. Below are the steps to create a URL service data control
1
2 give the
URL Endpoint : get url without the query
Source: give the query with param values in ## ## as illustrated below
3 Here it mandates the query to have a defaultvalue
4 Select the Employees.xsd and finish
You can now see the data control in the data control pallet
You can now drag and drop loaddata Action into the amx page as ADF Mobile Parameter Form . Drag and drop employee as ADF Mobile List View.
You can now preview and run the app. For reference you can also download the source code