Consuming Web Services in InfoPath Part 3: Designing the Form
Now for the form. Let's not focus on the design of the form here...
- Create 5 fields. 4 of the fields are whole number fields, with default value = 0, with the following name: Copper, Aluminium, Lead, Ferrous. 1 of the field are decimal field with the name, Total.
- Drag and drop the 5 fields into the form
- Right click each whole number fields, and select [Rules]
- Click [Add]
- Give the rule a name
Setting the parameters
Add the first action. This action is to set the parameter of the Web Service.
- Click [Add Action]
- Select [Set a field's value]
- Click the icon besides the [field]
- In the [Data Source] dropdown, select "MetalExchange (Secondary)"
- Expand the [queryFields], and select "CopperWeight"
- Click [OK]
- Click on the icon besides the [value] field
- Click [Insert FIeld or Group]
- In the [Data Source] dropdown, select "Main"
- Select "Copper"
- Click [OK]
- Click [OK]
- Click [OK]
Repeat the above steps for the rest of the three metals
Now, your rules screen should look like this.

We are not done yet...
Executing the Web Service
- Click on [Add Action]
- Under [action], select "Query using a data connection"
- Make sure your data connection is selected in [Data connection]
- Click [OK]
- Click on [Add Action] again
- Select [Set a field's value]
- Click the icon besides the [Field] field
- Make sure the [Data Source] is "Main"
- Select "Total"
- Click [OK]
- Click the icon besides the [Value] field
- Click on [Insert Field or Group]
- Under [Data Source] select "MetalExchange (Secondary)"
- Expand [dataFields]
- Select "GetPriceResult"
- Click [OK]
- Click [OK]
- Click [OK]

- Click on [OK]
- Click on [OK]
Admin publish the form, and do all the necessary steps to allow you to fill up an instance of the form. But you will soon realise that access is denied to the data connection file...