Overview
Template by Sruthy Lal | November 10, 2015

A web service is a software system designed to support interoperable machine-to-machine interaction over a network. In ClaySys AppForms you can connect to the webservice to read/write data unless you have restrictions from the server to have the connectivity to the webservice from the server.

Here we will be using a webservice called ‘Currency Convertor’, to get the conversion rate from one currency to another currency. The label will display the currency conversion rate of two countries from the two comboboxes. Also we can calculate the equivalent amount of money based on this conversion rate in the textboxes. If we select the currency codes of countries from the two comboboxes, two text boxes available in the right side of the page will be enabled. We can enter currency amount in one of the text box and the other will give the corresponding amount based on the conversion rate.

Prerequisite(s)
  • Sharepoint 2013
Data Structure
Here we are using Webservice as datasource. WebService Example: http://currencyconverter.kowabunga.net/converter.asmx?wsdl Username and Password are not required for this Public Web service
Design And Configuration
Here we will be using a webservice called ‘Currency Convertor’, to get the conversion rate from one currency to another currency. The label will display the currency conversion rate of two countries from the two comboboxes. Also we can calculate the equivalent amount of money based on this conversion rate in the textboxes. If we select the currency codes of countries from the two comboboxes, two text boxes available in the right side of the page will be enabled. We can enter currency amount in one of the text box and the other will give the corresponding amount based on the conversion rate.

List Of Forms Used
Name Functionality
WebService Form Design Rule Design WebService form is used to get the conversion rate from one currency to another currency.Also we can calculate the equivalent amount of money based on this conversion rate.
WebService
WebService Form Design
01
Create Form

On clicking the New Folder option, it will create a new folder and the name will be in the edit mode. You can type in the new name for the folder.

02
Rename Form

Then click on the ‘New Form’ link on the toolbar. Give an appropriate name for the form. Click ‘Save Form’ to save the form.

03
Publish Form

You can drag and drop controls format styles easily. ‘Check-In Form’ to save the changes and publish to get the completed form for the end user to use. A form must be checked-out to make modifications while all aspects of the form can be examined while checked-in.

04
For configuring datasources of ComboBoxes, Click on the ComboBox control and click the DataSources tab to edit the DataSource.A pop-up window appears to select the item source. Select the Item Source as ‘Static’ so that the values can be given as static.

Datasource tab in Quick View
Datasource Type
Form Preview
05
Create Datasource

For configuring WebService as datasource, click on the ‘Create DataSource’ link on the left side of the designer.

06
Datasource name and type

Give the DataSource name and select the DataSource type as ‘Webservice’. Click ‘OK’ to continue.

07
Choose Webservice

DataSource configuration wizard with all the WebService datasource mapped will be populated. Select the ‘Currency Convertor’ DataSource from the available DataSources. Click ‘Next’ to continue.

08
Click ‘Add’ button to add the Select command. DataSource operation in webservice can be defined only for ‘Select’.Select the DataSource object as ‘ConversionRate’. Click ‘Next’ to continue.

Adding Select Command
Select Datasource Object
09
A sample SOAP request

A sample SOAP request shows. Click ‘Next’ to continue.

10
Mapping Input Controls

Enter the control name for the selected DataSource object for XML request. In the request XML view, give the ‘FromCurrency’ as ‘cmbCountry1’ combobox and ‘ToCurrency’ as ‘cmbCountry2’ combobox .Click ‘Next’ to continue.

11
A sample SOAP response

A sample SOAP response shows. Click ‘Next’ to continue.

12
In the response XML view, give the ‘ConversionRateResult’ as ‘txtConversionRateResult’ textbox. Click ‘Next’ to continue.DataSource operation for ‘Select’ is now defined.

Mapping Output Controls
Configured Select Command With No Trigger(S) Associated
13
Once the Datasource operation is defined, it is bound to a control or event that triggers its execution. It is given by ‘Add Trigger’ button.So that the corresponding ExecuteCommand rules will be created with associated trigger.We can add the trigger by clicking the check box corresponding to the control.Click ‘Create Rule’ will automatically create the corresponding ExecuteCommand( ) rule for the select command associated with the trigger.Click ‘Finish’ to save and close the datasource configuration.

List Of Controls
Adding Trigger & Rule Creation
Select Command with Associated Trigger(S)
Rule with Attached Trigger(S)
WebService Rule Design
01
Rule Name : GetcurrencyConversionRate | Trigger(s) : cmbCountry1 , cmbCountry2
Rule – GetcurrencyConversionRate

The rules section is the most powerful section in the AppForms. The rules can be configured using the Rules Engine. The rule named ‘GetcurrencyConversionRate’ is basically the DataSource select operation of webservice. Based on the two conditions shown in the figure, the textbox controls can be enabled/disabled and the values of ‘ConversionRateResult’ are populated from the webservice also fills the values of ‘Equivalent amount’ label controls on comboboxes (‘cmbCountry1’ and ‘cmbCountry2’) trigger. This process is converted into concise, yet readily understood rule expression statements that represent the underlying execution logic of the form as shown in the figure.

02
Rule Name : CalculateToAmount | Trigger(s) : txtFromAmount
Rule – CalculateToAmount

The rule is named ‘CalculateToAmount’ gives an equivalent amount of money in ‘txtToAmount’, which is the multiplicative amount of ‘txtConversionRateResult’ and the ‘txtFromAmount’ on ‘txtFromAmount’ trigger.

03
Rule Name : CalculateFromAmount | Trigger(s) : txtToAmount
Rule – CalculateFromAmount

The rule is named ‘CalculateFromAmount’ gives an equivalent amount of money in ‘txtFromAmount’ which is the divided amount of ‘txtToAmount’ and ‘txtConversionRateResult’ on ‘txtToAmount’ trigger.

Template Summary
The purpose of this template is to be a reference for any person wishing to implement or any person interested in the architecture of the webservice with the ClaySys AppForms. With this template it is easier to understand the working of webservice with the ClaySys AppForms.