Wednesday Jun 24, 2015
Monday Feb 24, 2014
By Jeff Davies-Oracle on Feb 24, 2014
Recently, Oracle announced the new Mobile Suite product. Mobile Suite includes the ADF Mobile product for designing mobile applications that can run on both Android and iOS devices. Mobile Suite also includes the Oracle Service Bus (OSB), something that decidedly does not run on mobile devices. So naturally customers are asking me, “Why use Oracle Service Bus?”
The short answer is this: for mobile-enablement of the enterprise. There is more to mobile than just mobile devices. There must be support for emerging and future trends in mobile computing. The last thing anyone wants to do is to have to re-write their enterprise systems to support mobile technologies. Rewriting your existing systems to support mobile, cloud and future technologies is simply not practical.[Read More]
Thursday Jan 10, 2013
By Denis T-Oracle on Jan 10, 2013
This article discusses and demonstrates the use of REST web services in your ADF Mobile applications.
First you should download the RESTDemo example application and install it and run it and take a look. The general usage of the app is that it takes a domain or IP address and returns you the geo-location of it. The app provides this in a form and then you can view it on a map as well. This demo uses a public web service provided by FreeGeoIP and it's author, Alexandre Fiori. NOTE: This service has a throttling mechanism of 1000 queries an hour so if you get a 403, you should wait until the next hour before you test again.
There are two flavors of REST supported by ADF Mobile. The first we'll talk about is REST XML. The nice thing about REST XML is that it's structure is defined by an XSD and thus the design-time knows that the format should be and can provide you with a shape for the data when building your app. You use the URL Data Control wizard from the new gallery to define a Data Control backed by a REST XML service. You need to supply an XSD that defines what the structure will be. Note: if you have a service that returns XML but you don't have an XSD, there are many free utilities that will generate the XSD for you. When specifying the endpoint, you should typically keep this to the minimum needed for all methods of your web service. You then specify the HTTP method for the method of your service you want to invoke. Note that if you have a single service that supports multiple methods, you should be selecting the same endpoint and just keep adding methods to it, DO NOT generate separate Data Controls for each method. Any extra info you need for specific methods, including parameters should be put into the Source field.
Once your DC is created, it can be used just like any other Data Control. You can optionally decide to invoke these Data Control methods from Java and follow the techniques outlines in the Web Service example #2 in this blog if you wish.
The REST XML Data Control for the Geo IP is used directly in the REST-XML feature and shows you how to declaratively use the DC without a bean.
Because of the loosely structured nature of REST JSON services, there is no declarative model available for most because they do not provide a consistent way to describe the shape of the data model. The way to use REST JSON services with ADF Mobile is to execute these services with our helper classes and then use the supplied JSON parsing classes to create beans from the data and bind your UI to those beans.
In the second feature, REST-JSON, we have a managed bean created called RESTJSONBean. This bean maintains the parameter that we send to the service method along with the JSON response that is returned.
Steps to invoke and parse the REST JSON web service:
- The bean method loadData first declares an instance of the RestServiceAdapter class. This is a helper class that lets you invoke REST web services and simply returns the results in string format.
- The RestServiceAdapter lets you set the connection name (from connection.xml), the request type (GET/POST/etc), what the retry limits are and then you can specify anything else you want added to the URI.
- The send method of the RestServiceAdapter is invoked and the service is called and the JSON string is returned.
- To easily parse the JSON string into a bean, we provide the JSONBeanSerializationHelper class. This class has a fromJSON method where you can specify the destination class type and the string to parse and it will return an object of the class you specified. In our case, we have defined a RESTJSONResponse class to hold our GeoIP information returned from the service.
Now that the service is invoked and the results are parsed into the bean, the UI is updated because it is already bound to the bean DC. With the REST JSON version of this you don't need a Data Control for the service, but you do need a connection in your connection.xml to store the URL connection. You can optionally bind the data directly to your bean or create a Data Control out of the Bean and bind that to the UI. Normally it's easier to do the latter once you understand the binding framework.
This pretty much completes this example. I've added the map just as a nice UI representation of geo-coordinate supplied by this service. In the future you will see some more structured REST JSON web services coming out of Oracle that have methods that provide schema information. This will allow us to use them declaratively within ADF Mobile.
Good luck and happy coding!
This blog is is dedicated to announcements,tips and tricks and other items related to developing, integrating, securing, and managing mobile applications using Oracle's Mobile Platform. It is created and maintained by the Oracle Mobile product development team.
Archive of past entries
Even More Mobile Development Blogs
Oracle A-Team Site - Mobile Related Entries
Code samples from the Community
Fusion Middleware Blogs
- MAF 2.2.2 release available now
- No Parse, We are "Moving on"
- Oracle Cloud Helps Credorax Deliver Crucial Mobile Apps
- Oracle at Mobile World Congress, 2016
- New York MTA, Mobile + Cloud
- A quick checklist for setting up your iOS application for Oracle Mobile Cloud Service
- Oracle Mobile Application Accelerator (MAX)
- MAF MCS Utility Patch for MAF 2.2.1
- A little taste of Swift with Oracle Mobile Cloud Service
- MAF and iOS 9 multitasking