Shay Shmeltzer's Oracle Development Tools Tips

ADF Mobile - Update through Web Service (with ADF Business Components)

Shay Shmeltzer
Director of Product Management - Oracle

In my previous blog entry I went over the basics of exposing ADF Business Components through service interfaces, and developing a simple ADF Mobile application that access and fetches data from those services.

In this entry we'll dive a bit deeper  and address an update scenario through these web service interfaces.

You can see the full demo video at the end of the post.

In the first steps I show how to add an explicit method execution to fetch a specific record we want to update on the second page of a flow.

For an update you'll be invoking a service method and passing the record you want to update as a parameter. As in many other Web services scenarios, we need to provide a complete object of specific type to the method. The ADF Web service data control helps you here by offering an object of this type that you can drag and drop into your page.

The next step is to make sure to fill that object with the values you want to update. In the demo we do this through  coding in a backing bean that shows how to use the AdfmfJavaUtilities utility. The code gets the value from one field, gets a pointer to the parallel update field, and then copy from one to the other.

At the end of the bean we manually execute the call to the update method on the Web service.

Here is the demo:

Here is the code used in the backing bean in the demo above.

package a.mobile;

import oracle.adfmf.amx.event.ActionEvent;
import javax.el.MethodExpression;
import javax.el.ValueExpression;

import oracle.adfmf.amx.event.ActionEvent;
import oracle.adfmf.framework.api.AdfmfJavaUtilities;
import oracle.adfmf.framework.model.AdfELContext;
public class backing {
    public backing() {

    public void copyAndUpdate(ActionEvent actionEvent) {
        // Add event code here...
        AdfELContext adfELContext = AdfmfJavaUtilities.getAdfELContext();
        ValueExpression ve = AdfmfJavaUtilities.getValueExpression("#{bindings.DepartmentName.inputValue}", String.class);
        ValueExpression ve3 =
            AdfmfJavaUtilities.getValueExpression("#{bindings.DepartmentName1.inputValue}", String.class);
        ve3.setValue(adfELContext, ve.getValue(adfELContext));
        ve = AdfmfJavaUtilities.getValueExpression("#{bindings.DepartmentId.inputValue}", int.class);
        ve3 = AdfmfJavaUtilities.getValueExpression("#{bindings.DepartmentId1.inputValue}", int.class);
        ve3.setValue(adfELContext, ve.getValue(adfELContext));
        ve = AdfmfJavaUtilities.getValueExpression("#{bindings.ManagerId.inputValue}", int.class);
        ve3 = AdfmfJavaUtilities.getValueExpression("#{bindings.ManagerId1.inputValue}", int.class);
        ve3.setValue(adfELContext, ve.getValue(adfELContext));
        ve = AdfmfJavaUtilities.getValueExpression("#{bindings.LocationId.inputValue}", int.class);
        ve3 = AdfmfJavaUtilities.getValueExpression("#{bindings.LocationId1.inputValue}", int.class);
        ve3.setValue(adfELContext, ve.getValue(adfELContext));
        MethodExpression me = AdfmfJavaUtilities.getMethodExpression("#{bindings.updateDepartmentsView1.execute}", Object.class, new Class[] {});
        me.invoke(adfELContext, new Object[] {});

Join the discussion

Comments ( 10 )
  • Jaber Taslaq Tuesday, November 20, 2012


    can we simply use set property listener on the update button to copy each value to it's appropriate update field? if yes which one you think is faster ??


  • Shay Tuesday, November 20, 2012

    Jaber, depending on the scenario a setPorpertyListener might work. If you'll try it in this case you'll see that you might run into problems while copying into key fields.

  • guest Tuesday, January 8, 2013

    Hi Shay,

    Is there a way to download source code for above demo ?

  • shay shmeltzer Wednesday, January 9, 2013

    guest, I don't have the code packaged - but if you just follow the video everything should work. If it doesn't post your issue on the OTN ADF Forum.

  • guest Wednesday, January 9, 2013


    It would be nice to see an application that uses ADF Business Components through web service interface, AND List of values...

  • guest Tuesday, May 14, 2013

    Hello Shay

    After executing the datacontrol method, How can I get the return value?

  • Shay Tuesday, May 14, 2013

    guest - check out the sample here to see how to invoke a WS programmatically - https://blogs.oracle.com/mobile/entry/web_services_example_part_2

  • guest Tuesday, August 27, 2013

    Hi Shay,

    I had used your article and the video to successfully update the data through adfbc webservices. When I try to add a selectonechoice to the update field, it throws me an error back saying "The selected target attribute has read-only access.Please select an updateable attribute". Is there a workaround to handle this kind of update scenario.


  • Usman Riaz Monday, June 23, 2014

    i tried updating and i succeed. but when i tried deleting it the same way on the same page i get this error

    Error invoking method 'execute' in 'class oracle.adfmf.bindings.dbf.AmxActionBinding'

  • guest Wednesday, March 18, 2015

    Hi Shay,

    When I create web service data control based on BPEL Service, I am not seeing any info in properties window for selected attribute to make them updatable.

    I looked at all XML and Java files and did not see anywhere I can make these attributes updatable.

    I am using 12c. any ideas?



Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.