WebService
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
NameFunctionality
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.

How To

A how-to is an informal, often short, description of how to accomplish a specific task. A how-to is usually meant to help non-experts, may leave out details that are only important to experts, and may also be greatly simplified from an overall discussion of the topic.

  • Add Web Part

    01

    Click on Site Settings Wheel in the upper right corner of your site and then select “Site Contents Page”.

    02
    SitePages

    Select site pages or simply pages library on site content page.

    03
    Wiki Page

    Click on “new Wiki page” to add new site page.

    04
    New Page

    Give the New page name into the pop-up window and click ‘Create’ to add new page.

    05
    ClaySys HTML WebPart

    To add a new web part, click on the ‘Insert’ tab and then click on the ‘Web Part’ button. Then select ClaySys -> ClaySys HTML Web Part.

    06
    Edit The WebPart

    Click ‘Add’ button to add the Web Part. Click on the ‘edit the Webpart’ link to edit the page.

    07
    WebPart Configuration

    A new pop-up window appears and here we can configure the ClaySys AppForms by clicking on the ‘Configure’ button.

    08
    Selecting Form

    Pop-up appears with listed published forms. We can select the appropriate form by clicking on the form and add the form by clicking on the ‘Select’ button.

    09
    WebPart

    Once the configuration is finished, click on the ‘Apply’ button to see the changes. Click ‘OK’ button.

    10
    WebPart

    Now you can see the web part page you just created, as shown in the following image. Click ‘Save’ button to save the changes.

    11
    Title

    The Forms added to the WebPart may contain "Claysys HTML WebPart" as Default title. The title can be changed by editing the Title in the "Appearance" after configuring the form.

  • Import Tenant

    01
    Backup and Restore

    Click on the “Back Up and Restore” on the left side of the AppForm Designer window. Then click on ‘Import Site’ -> Browse the Tenant and click Load.

    02
    Mapping Site

    Select the ‘Zip File’ and ‘Site Name’ and click ‘Next’.

    03
    Datasource Mapping

    Click ‘Next’ button.

    04

    Click on ’Import’ button . Once it done you are free to work with the form in the new site.

    List Mapping
    Import Tenant
Downloads
No downloads has been associated with this template.

Sruthy Lal

I love pushing the limits to see what I can do next. I do what I love and I love what I do.

Leave a Reply