Web Services Example - Part 1: Declarative

In this edition of the ADF Mobile blog we'll tackle part 1 of our Web Service examples. In this posting we'll take a look at using a declarative SOAP Web Service.

Getting the sample code:

Just click here to download a zip of the entire project. You can unzip it and load it into JDeveloper and deploy it either to iOS or Android. Please follow the previous blog posts if you need help getting JDeveloper or ADF Mobile installed.

Defining our Web Service:

First off, we should mention that this sample code is using a public web service provided free by CDYNE Corporation that provides weather forecasts by zipcode. Sometimes this service goes down so please ensure you know it's up before reporting this example isn't working.

Let's take a look at the web service.  We created this by using the "Web Service Data Control" from the New Gallery and using this link to this wsdl:  "http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL"   This web service has several methods but we're interested in GetCityForecastByZIP which takes a single string parameter for the zipcode and the second method, GetWeatherInformation that enumerates all possible forecast descriptions and associated image URLs.  The latter we'll use in the next edition but we included it here for completeness.

Defing the Application:

After adding a feature to the adfmf-feature.xml file, we added a taskflow to host the application flow.  This comprises of a home screen with a list with items for each method in the web service, "Forecast by Zip" and "Weather Info".  In this application we've also decided to hide the navigation bar since there is only one feature in the application.

Forecast by Zip:

The "Forecast By ZIP" option first presents the user with a screen where they can enter a zipcode and when the "Search" button is tapped, it executes the GetCityForecastByZIP method.  This is done by binding an Action binding to that method. The easiest way to accomplish this is to just drag & drop the method from the Data Control palette to the AMX page and drop it as a button and let the framework hook it up for you.  There is an inputText component on the page that is bound to a pageFlowScope variable called "zip".  This is used as the parameter to the Action binding when it is executed.  Because the actionListener attribute of the commandButton executes the Web Service each time, we ensure that the method is invoked every time the button is clicked.

Weather Info:

Unlike the previous method, this time instead of explictly executing the web service method we are using deferred invocation.  What this means is that we will bind to the results of the method and the framework will execute the method when it the data is required to be rendered.  We do this by simply doing a drag & drop of the results of the GetWeatherInformation to the AMX page.  When the page is rendered and the bindings are resolved the framework invokes the method.  This executes the method only when it is needed and fills the Data Control provider.  Because we never re-execute the method, you can click from Home to Weather Info and back many times and the web service is only ever invoked once.

Issues and Possible Improvements:

One thing you will quickly realize with this example is that the error handling is done by the framework for you. For simple examples this is fine but for real applications you'll want to customize these error messages.  With the declarative invocation of web services, this is difficult.  This is one aspect we'll address in the second installment of the web service examples where we will show you how to do programmatic invocation which allows you better error handling.

Another issue you will notice with this example is that we can enumerate the weather information but there isn't an easy way to use that information to show the corresponding description and image as part of the forecast results.  We'll show you how to do this in the next example.


Hi Denis,

If we were to build a ADF Mobile application using Fusion Webservice. Can I us the same method? Fusion web service data control shows objects instead of input parameter. So, how can we create parameter forms (by dragging) etc using such web service?


Posted by guest on December 11, 2012 at 01:00 AM PST #

Because of the way Fusion Web Services are constructed, it's very hard to send a parameter in declaratively. You can use the object to create the parameter form declaratively but then you need to build a genericType object and send it into the web service. I'll post an example using an ADF-BC service interface soon.

Posted by DenisT on December 11, 2012 at 11:28 PM PST #

Pradeep - this blog/demo might be useful to see how to pass a parameter of "object" type to a Web service data control - https://blogs.oracle.com/shay/entry/calling_web_service_with_complex

Posted by shay shmeltzer on December 14, 2012 at 10:04 AM PST #

I am trying to implement basic CRUD operation in the ADF mobile application, an I need to work with the data supplied by the web service.
I have read several articles on the web, i.e.:


an similar, but "direct work" with Web services confuses me a bit.
At first, I came up with the idea to integrate the web service with ADF business components as described in
but just discovered that ADF Mobile doesn't support Java Web Service proxy:

so I am goind to use Web Service Data Control directly.

For example, I exposed the Update and Find (by SQL statement) operations for one of my BC View Object in the App module Service interface, and (in the ADM mobile app) I created the Web Service data control.
Dropped the result of Find operation on the .amx page as amx:listView, and then show the current row data on the amx:popup, in order to update them.

So popup shows data from the same iterator as a listView.

The popup have OK-Cancel button, therefore, the usual situation that is often found in ADF Fusion web application.
Then, I change the value of one or more fields.

1. The first problem - I do not see a way to undo the change when the user pressed Cancel button.
In the ADF Fussion web app, there is number of approach, for example:


Wondering, how to translate this code in the ADF mobile app ?
When I close popup (with amx:closePopupBehaviour), the data I changed on the popup remains on the read-only viewList behind popup too.
I need a way to discard changes.

2. The second question - when user inserts a new record on the popup, (thus performing web service Create operation), how to refresh amx:listView in order to show that new record ? Similar for deletion

3. And finally - how to deal with exceptions which may occur durring CRUD operation ?

- Thanks,...

Posted by Cvele_new_account on January 14, 2013 at 09:47 AM PST #


Can you please take a look at the OTN forum question I posted ragarding web service & ADF mobile ?



Posted by Cvele_new_account on January 14, 2013 at 09:49 AM PST #

Excellent article. I tried doing for '://www.webservicex.net/uszip.asmx?WSDL' it is returning any. which I am not able to design.

Can you please help.

Posted by guest on March 21, 2013 at 10:08 AM PDT #

The webservice is publicly hosted and not controlled by Oracle and thus it goes down on occasion. I just tried the link to the WSDL and it is working fine now. Please retry.

Posted by Denis T on March 21, 2013 at 11:02 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

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


« March 2015