RSS

Update/Insert With ADF Web Service Data Control

14 May

The Web service data control (WSDC) in ADF is a powerful feature that allows you to easily build a UI on top of WS interfaces exposed by other systems.
However when you drag a WSDC to a page you usually get a set of output components where the data is shown. So how would you actually do an update operation on those values?
The answer is that you need a call to another method in your WSDC that does the update – but what if you want to pass to it the actual values that you get from the get method you invoked before?
Here is a demo showing how to do that:

The two tricks that are shown here are:
Changing the properties of items in the DC to be updateable – this gives you inputText fields instead of outputText fields.
And passing the currentRow.dataProvider to the update method (and choosing the right iterator for this).

Advertisements
 
12 Comments

Posted by on May 14, 2010 in Uncategorized

 

12 responses to “Update/Insert With ADF Web Service Data Control

  1. Navin

    June 2, 2010 at 9:47 am

    Hi Shay,
    Thanks for blogging as to how we can do insert/update using WS data control.
    However my use case is as follows: Data is shown in a read only list. User is provided with Create & Edit buttons.
    Upon “Create”, a blank free form is to be displayed in a popup where in user can key in information and hit “Save”. This will close the popup and then refresh the list to display the newly added record.
    Alternatively user can select a record in the table and click “Edit”. In this case the selected record is displayed in free form in popup where he can update the information and save.
    Can we achieve both Insert & Update in declarative manner ? Please suggest optimum way of handling this requirement.
    Thanks
    Navin

     
  2. shay.shmeltzer

    June 3, 2010 at 2:27 pm

    Navin, It should be quite straightforward to take the approach I’ve shown and just place the insert/update inside a pop-up components in your ADF Faces page.

     
  3. Jeff

    September 16, 2010 at 12:02 pm

    Shay,
    The information is GREAT!
    I have tried this in my web application with Peoplesoft, but get error. Do the parameters of ‘Update’ method must match the return fields in ‘Get’ method?
    Thank you,
    Jeff

     
  4. shay.shmeltzer

    September 16, 2010 at 12:30 pm

    To work in this way you need the same object from the get and the set. However you can also do some tricks to map it to different objects.
    See this blog entry for how to set parameters: http://blogs.oracle.com/shay/2009/07/java_class_data_control_and_ad.html

     
  5. Cruyhyn

    October 12, 2010 at 5:59 am

    I can’t see anything…

     
  6. shay.shmeltzer

    October 12, 2010 at 7:15 am

    It’s a youtube video – make sure you have flash installed – or look for it on my channel on youtube – youtube.com/user/shayjdev

     
  7. cosmoghurl

    November 18, 2010 at 6:56 pm

    hi shayne,
    thanks for this vid. I just have few questions regarding my application. It almost the same as yours,except that the getEmployee part is triggered once the view button is hit (thus upon load of page, no value is displayed yet)… So, there’s an input text,wherein user should key-in the employee id. then clicking the View button, it should call the data control, passing the input text value… after calling the web service, it should return values in a table.. I followed the video,however, the table values is not being reflected on the page (or i think,even the input text value is not being passed to the data control). can you suggest what should i tweak in my components?
    thanks!

     
  8. shay.shmeltzer

    November 22, 2010 at 11:33 am

    cosmoghurl, you can delay the execution of a method that depends on a parameter as shown here:
    http://blogs.oracle.com/shay/2010/08/delay_method_execution_when_us.html

     
  9. Pri

    February 15, 2011 at 4:03 am

    Shay,
    Thanks for blogging.
    My requirement is to insert data into two databases using two different webservices. But the information should be inserted using a single button not two adf buttons. Any help on how to acheive this would be great.
    thanks!

     
  10. shay.shmeltzer

    February 15, 2011 at 10:18 am

    Pri – check out this entry to see how you can invoke two operations from one button:
    http://blogs.oracle.com/shay/2010/04/doing_two_declarative_operatio.html

     
  11. Kartick

    February 25, 2011 at 2:31 am

    Video is not displayed even after installing latest flash player. Kindly check it.

     
  12. shay.shmeltzer

    February 25, 2011 at 11:04 am

    You can see the demo directly on my YouTube channel:


     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: