HowTo: Using external services in a Smart Device App

Unofficial Content

As Mobile and Smart Devices apps are increasing in popularity lots of companies and developers are trying to do their Smart Device branch of their system. So if the Smart Device app is going to be a part of a whole system it should integrate with it. The way that the mobile app can integrate to the main application is by a Service Layer. Take into consideration that this service layer can or cannot be done with GeneXus.

So there is the need to be able to consume external web service without losing the main features of the Work With Devices pattern such as Filters, Search, Paging, Orders and Break-by.

In every Smart Device's Grid of a Work With Devices object, GeneXus automatically generates a service that supports the above features mentioned. So the solution is to be able to interact with third-party services (not generated by GeneXus or generated by GeneXus but with no control from the Smart Device app KB). This is done by letting the developer interact with the interface that GeneXus Service is generated with.

In the example considered, the parameters managed by this automatic service are:

&SearchText  VarChar(1000)  // The Text to the search
&SearchField Numeric(10.0)  // Field by we are doing the search. If 0 means all if not is the number of the att defined on the conditions tab.
&start       Numeric(10.0)  // States from which record the answer will bring data.
&count       Numeric(10.0)  // Indicates how many registers have to be brought. 0 means all.
&OrderedBy   Numeric(10.0)  // Indicates which order is going to be used. Base 1.

For Advanced Filters:
- Standard: the name will be "C" + <variable_name>
- Range: "C" + <variable_name> + "From" and "C"+ <variable_name> + "To"

Scenarios

In this document it is going to be detailed two examples which will cover all the features exposed.

Two paths are available to develop the examples:

  1. Programming the logic in the Smart Devices object (precisely in the Load Event). Learn more.
  2. Using a procedure to manage the parameters and do the mapping between our Smart Device's Grid and our external Services. Learn more.

See also