General Interface is an open source project hosted by the Dojo Foundation

Defining Mappings

In this step, you'll define mappings between the GUI components of the myAddressLookup application and the data exposed by the web service.

The Address.wsdl file used in the myAddressLookup project defines several operations. Because you only use one operation for the myAddressLookup application, ReturnCityState , you can remove all other operations for the rules file as they aren't needed.

Defining Mappings for Input Data

To define mappings between the GUI components and the input (request) data, complete these steps:

  1. Select the ReturnCityState operation in the Rules Tree panel. Confirm that it's the correct rule by reading the Schema source in the pane below:
    <operation name="ReturnCityState">
  2. Delete all other operations by selecting Delete > Unselected Sibling Rules.
  3. Arrange the Component Hierarchy palette and the Rules Tree panel so that components and mapping rules are visible.
  4. Create a mapping between the txtZipcode component and the zipcode rule as follows:
    1. Expand the ReturnCityState rule in the Rules Tree panel.
    2. Expand the Input (request) rule and double-click the ReturnCityState child rule. The ReturnCityState request has two input rules: zipcode and LicenseKey.
    3. Drag the txtZipcode component from the Component Hierarchy palette to the zipcode rule in the Rules Tree panel. The following mapping is created in the rules tree.
      Click here to expand screenshot...


      Notice in the Mappings table to the right that the Type is DOM (Document Object Model), representing a mapping between a GUI component and a rule in the rules tree.
      The value is txtZipcode, the name of the GUI component.
      Click here to expand screenshot...


      Next, you'll use the setValue() method to set the license key value to use the evaluation license ("0"). The evaluation license provides limited access to the service during testing. If the designated number of requests is exceeded, an error is returned.
  5. Set the value for the license key as follows:
    1. Click the LicenseKey rule in the Rules Tree panel.
    2. Select Script from the drop-down list in the Type column of the Mappings table.
      Click here to expand screenshot...


    3. Type the following in the Path/Value field of the Mappings table:
      setValue("0");
      Because the license key value, zero, is a JavaScript string, it must be enclosed in quotation marks.

Defining Mappings for Output Data

To define mappings between the application GUI components and the return (response) data, complete these steps:

  1. Expand the Output (response) rule and double-click the ReturnCityStateResponse rule.
  2. Double-click the ReturnCityStateResult rule to expand it to see all the children.
    You'll only use two of the output rules: City and StateAbbrev.
  3. Select the output rules City and StateAbbrev, and delete all other operations by selecting Delete > Unselected Sibling Rules.
  4. Drag the txtCity component from the Component Hierarchy palette and drop it on the City rule in the Rules Tree panel.
  5. Drag the txtState component from the Component Hierarchy palette and drop it on the StateAbbrev rule in the Rules Tree panel.
  6. Save the rules file as follows:
    1. Click the Save button at the top of the XML Mapping Utility.
    2. Open the rules folder in the Save File dialog and type GetCityandState.xml in the field at the bottom of the dialog.
    3. Click Save to save the file.

Now that you've defined the mappings between the GUI components and the data exposed by the service, you need to generate the JavaScript function to call the service. This is the same function that is defined for the button's Execute event in General Interface Getting Started.

Contents

Searching General Interface Docs

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.