Coding Parameter Values for Web Services Binding
By Shay Shmeltzer-Oracle on Jul 11, 2007
I got a request for help from a partner yesterday, they were looking for a way to assign values to a list of parameters of a web service in a managed bean.
Since the day before that I answered a very similar question that also asked about the process to access the value of object on the screen through the binding layer, I figured out I might as well put the steps in a blog entry. I'm sure at one point in the future I'll probably need this again - this way it will be easily accessible.
With ADF binding it is very simple to create a JSF page that will let you insert a set of parameters in input items and then invoke a Web service passing these parameters.
All you need to do is create a Web Service Data Control based on the WSDL and then drag it onto your JSF page as an "ADF Parameter Form".
Now you have an inputText field for each parameter of the WS and a submit button that will invoke the WS.
Now if you want to fill out values for the parameters programatically do the following:
Go to the JSF source and remove the inputItems from there - Note that doing it this way will keep the binding for them in the pagedef.xml file.
Double click the submit button to create the method for it in a backing bean.
In that method you can use something like the following:
FacesContext fc = FacesContext.getCurrentInstance();
(In your case replace the param with the name of the binding for your specific parameter - you can find the name in the pagedef.xml file).
Note that in cases where you want to get the value of a binding item you can replace expr.setValue with expr.getValue.
More about this in chapter 17.5 of the ADF Developer Guide.
Note - update for 11g is here.