Databases Reference
In-Depth Information
How It Works
APEX computations allow you to apply computational algorithms at different events in your form. It can
be used to either display a computed value (for example, a monetary amount after a currency
conversion) to the end user (through a read-only text page item field) or to save the computed value in
the database.
3-7. Interacting with a Web Service
Problem
When you click a button in your form, you need to connect to a web service, pass it a parameter, and
have the web service return a value that you can then display on your form. For example, you may want
to display the latest currency conversion rate (retrieved from a web service) for two different currencies
specified through your form.
Solution
To test the solution in this recipe, you will first need to set up a sample form. After that, you need to add
a reference to the web service to your application. Finally, you will need to make use of that reference in
your form. Let's start by creating the sample form.
Creating the Sample Form
To create the sample form used in this recipe, follow these steps:
1.
The first thing you need to do is to create a sample form to key in the currency
codes (and to also display, in the same form, the currency rate retrieved via the
web service).
2.
Create a new application and add a blank page to the application. In the Page
Definition > Page Rendering area, create a new page item (a TEXT field) named
P1_FROMCODE. Use default settings for this page item. After that, create
another text field page item named P1_TOCODE with similar settings. Next,
create a NUMBER field page item named P1_RETURNEDRATE.
3.
Next, create a button in the form. Right click on the Items node and choose
Create Button. Specify P1_GETCURRENCYRATE as the name of the button, set
the Label field as Get Currency Rate, and change the button style to a HTML
Button (as shown in Figure 3-19). Finally, click Create Button.
 
Search WWH ::




Custom Search