Web Service Across Pages Called Twice

I first ran into this little trickery a few weeks back while helping some internal team with a POC, then yesterday this popped up again in another scenario, so here is a little thing that is a very common mistake when you first start to work with the ADF Data control.

The scenario is that you add a parameter page for the Web service in a JSF and a button that calls the Web service, and then you navigate to another page to show the results.
If your results are a collection of data, if you'll look carefully you'll notice that the Web service is actually invoked twice.
Once from the button, but then another time in a hidden way in the results page.
One thing you might encounter then is that the results that actually show up on the results page don't match your original parameters.

The solution is to have the first page just set the parameters and then pass them to the second page - where they are going to be used in the call to the Web service.

Here is a short demo that might make this clearer:


Comments:

Hey there,

i got the same problem with the only difference, that I'm using only one page. I want to display the results directly under the ADF Form.
But the problem is, that I cant use this workarround, because the output fields are on the same page.
It everytime invokes the webservice after rendering the page. All output fields are updated after pressig the "submit"-button. (sending the parameters to the webservice and receive the response)

I tried a lot of stuff to avoid the first invoke, but I dont found out, how this setup can work.

Do you maybe have a solution for it?

Thanks in advance!

Best Regards
Tim Lehming

Posted by Tim Lehming on November 11, 2011 at 01:54 AM PST #

Tim - see if this type of solution will help preventing the initial execution of the Web service on your page: http://blogs.oracle.com/shay/entry/delay_method_execution_when_us

Posted by guest on November 11, 2011 at 03:34 AM PST #

Hey,

thanks! That helped me a lot!

Best Regards
Tim Lehming

Posted by Tim Lehming on November 24, 2011 at 12:01 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

me
I'm a Director of Product Management for the Oracle Java Development Tools.
Follow me:
Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today