Configuring Web Services
|
|
What is a Web Service?
A Web Service is a method of communication between two applications or electronic devices over web. You can either use pre-defined web services that come along with the SummitAI application or build Custom Services based on your organization's requirement.
Web Services are of two types:
Simple Object Access Protocol (SOAP)
Representational State Transfer (REST)
SOAP defines a standard communication protocol (set of rules) specification for XML-based message exchange. SOAP uses different transport protocols, such as HTTP and SMTP.
The standard protocol HTTP makes it easier for SOAP model to tunnel across firewalls and proxies without any modifications to the SOAP protocol. SOAP can sometimes be slower than middleware technologies like CORBA or ICE due to its verbose XML format.
REST describes a set of architectural principles by which data can be transmitted over a standardized interface (such as HTTP). REST does not contain an additional messaging layer and focuses on design rules for creating stateless services. A client can access the resource using the unique URL and a representation of the resource is returned. With each new resource representation, the client is said to transfer state.
While accessing RESTful resources with HTTP protocol, the URL of the resource serves as the resource identifier and GET, PUT, DELETE, POST and HEAD are the standard HTTP operations to be performed on that resource.
Provide the Service URL to create a Web Service.
Figure: Edit Service URL
Service URL Example: http://<webserviceurl>/REST/Summit_RESTWCF.svc
Replace <webserviceurl> with base URL.
Web Service Authentication
The default Token-based API authentication is implemented for Web Service from the Sierra HF01 Release onwards. If you upgraded to the Sierra HF01 and want the User ID and Password-based authentication for Web Service, you can enable it.
Configuration
You can enable the User id and Password-based authentication by adding the following key in the SummitAI web.config file:
<add key="IsAPIKeyDisabled" value="true" />
Note:
If the key is not added in the web.config file or if the value of this key is set as false, by default, the Token-based API based authentication is enabled to log into the SummitAI application.
To preview a Web Service:
Select Admin > Basic > Infrastructure > Web Services.
Select a URL from the drop-down list.
Select a service from the Custom Services list.
Fill in all the mandatory fields and then click SUBMIT. The Output Data is displayed.
Figure: Web Services Preview page
Field Description
The following table describes the fields on the WEB SERVICES EXPLORER page:
Fields | Description |
|---|---|
Custom Services/Predefined Services | Displays the list of services available. Select a service from the list to extract data from the application through the Web services. Type in the name of the services to search from the list. Click Filters icon to filter the services according to modules.
|
View Custom Services | Click View Custom Services (highlighted in red color in the above image) to display the list of Custom Services created by the users. |
View Predefined Services | Click View Predefined Services (highlighted in green color in the above image) to display list of services already defined in the SUMMIT application. |
Refresh | Click to Refresh the list. |
URL | Select Input URL format from the drop-down list, either JSON Object or JSON String or XML.
Service URL example: http://<webserviceurl>/REST/Summit_RESTWCF.svc Replace <webserviceurl> with base URL. |
Mandatory Fields | Displays Mandatory Fields for the selected service. |
Input Data | Displays Input parameter for the selected URL Type. |
Output Data | Displays Output for the selected URL Type. |
Search Bar | You can search for the web services, based on their properties. For example, if you specify table in the search bar, all the existing tables will be displayed. |
To create Custom Services:
Click CREATE NEW. The WEB SERVICE DESIGNER page is displayed.
Figure: Web Service Designer pageType in the Web Service Name and specify the number of records to be displayed.
Note:
You can also create SQL Views, SQL Table, and SQL Procedure and modify the created fields.
Click icon to view, hide, or customize the Web Service properties.
Figure: Web Service PropertiesField Description
The following table describes the fields on the PAGE PROPERTIES section:
Fields
Description
Module Name
Select a Module for the Web Service.
Active
If selected, the Web Service configuration becomes active.
User Access
Type in the name of a user to whom you want to provide access to the Web Service.
View Only
If selected, the user will have read-only access to the Web Service and cannot do any modifications to it.
Report Description
Specify the description of the Web Service.
Select the check box to select DATA SOURCE from the list. You can scroll down to see all the available Data Sources or type in the Data Source name in the search box to search a particular Data Source.
Note:
Create Relationship between the Data Sources if you want to use multiple Data Sources.
Click GENERATE SQL to generate SQL Query.
Click PREVIEW to view the Output of the ongoing Web Service.
Click SAVE. The Web Service is added to the WEB SERVICE PREVIEW list.
Creating Custom Tables in Web Services:
To Create a New Custom Table:
Select Admin > Basic > Infrastructure > Web Services. The WEB SERVICE EXPLORER page is displayed.
On the WEB SERVICE EXPLORER page, click CREATE NEW. The WEB SERVICE DESIGNER page is displayed.
On the WEB SERVICE DESIGNER page, select Create SQL Table from drop-down list.
Specify the SQL Table Name.
Figure: WEB SERVICE DESIGNER page: Create SQL Table: SQL Table NameClick
icon in FIELDS section to view FIELD PROPERTIES.
Figure: WEB SERVICE DESIGNER page: FIELD PROPERTIESType in Field Name (or Column Name) and select the Data Type value from drop-down list. For more information about the fields on the FIELD PROPERTIES, see Field Description.
Click ADD NEW FIELD to add a new field (or Column).
Field
Description
Field Name
Specify the name for the field (or column).
Data Type
Select the required data type for the field (or column) from the drop-down list. Following are the available data types:
nvarchar: Select the data type as nvarchar to store variable characters (letters and numbers) in the field (or column).
Note: In the size parameter, specify the maximum column length in characters.int: Select the data type as int to store a whole number (not a fraction) in the field (or column).
numeric: Select the data type as numeric to store numbers that have fixed precision and scale.
decimal: Select the data type as decimal to store numbers that have fixed scale.
bit: Select the data type as bit to store a single bit with a value of 0,1, or NULL
datetime: Select the data type as datatime to store date and time combination in the field (or column).
text: Select the data type as text to store text or combinations of text and numbers in the field (or column).
Auto Identity
Select this check box to define a field (or column) as auto increment field.
Note:
This field is displayed only for int, numeric, and decimal data types.
Primary Key
Select this check box to define a field (or column) as Primary Key.
Note:
Primary keys should contain unique values and cannot have NULL values.
Click GENERATE SQL to generate the SQL Query.
Figure: GENERATE SQL (sample screenshot)Click SAVE to successfully create the SQL Table. Click YES if you want to redirect to the Web Service Explorer page.
You will be able to create a new table in webservices using excel. You can also view or modify the created table. You can view the table along with the records unlike creating table with SQL where you can view only SQL queries in the Web Service Explorer. You can also import and export the records in the excel.
Creating New Table using Excel
The following section provides information on how to create a table using Excel.
To Create a New Table using Excel, perform the following steps:
Select Admin > Basic > Infrastructure > Web Services. The WEB SERVICE EXPLORER page is displayed.
Figure: WEB SERVICE EXPLORER pageOn the WEB SERVICE EXPLORER page, click CREATE NEW. The WEB SERVICE DESIGNER page is displayed.
Figure: WEB SERVICE DESIGNER pageOn the WEB SERVICE DESIGNER page, select Create SQL Table from the drop-down list.
Figure: WEB SERVICE DESIGNER page: Create SQL TableSpecify the SQL Table Name.
Figure: WEB SERVICE DESIGNER page: Create SQL Table: SQL Table NameClick GENERATE TABLE to create a table using excel import.
Figure: WEB SERVICE DESIGNER page
The MASTER IMPORT page is displayed with the following three tabs:
1. UPLOAD EXCEL
2. MAP COLUMNS
3. UPLOAD MASTER
Figure: MASTER IMPORT pageSpecify the required fields on GENERAL tab.
Figure: GENERALClick on the download icon and it will open your file browser window to select the required Excel file from the location.
Figure: Browser WindowClick SUBMIT to import the selected excel sheet as source.
Figure: GENERALThe uploaded excel file will display all of the available sheets inside it and you can choose the required sheet for mapping which needs to be uploaded if the uploaded excel sheet has more than one sheets. Select the required record and click on Select hyperlink. The MAPPING page under the MAP COLUMNS tab is displayed:
Figure: MAPPINGField Description
The following table describes the fields on the MAPPING page:
Fields
Description
Column Name
Displays all the columns name mentioned in the uploaded excel sheet.
For Example in the above screenshot, LeaveHistory Excel displays the columns such as Leave Type, FromDate, ToDate,NoofDays, Status, Remarks and ApprovalStatus.
Data Type
Data Type defines which type of value can be provided for the respective column. Respective column input value should be in same data format. For Example: If Data Type for column name NoofDays is defined as an Integer, then the input value in this column should be an integer only.
Select the required data type for the field (or column) from the drop-down list. Following are the available data types:
Number - Select the data type as Number to store numbers that have fixed precision and scale.
Integer - Select the data type as Integer to store a whole number (not a fraction) in the field (or column).
String - Select the data type as String to store variable characters (letters and numbers) in the field (or column).
Bool - Select the data type as Bool to store a single bit with a value of 0,1, or NULL.
Date - Select the data type as Date to store a date in the field (or column).
Note:
Format of Date must be DD:MM:YYYY
Date Time - Select the data type as Date Time to store date and time combination in the field (or column).
Time - Select the data type as Time to store a date in the field (or column).
Note:
Format of time must be HH:MM:SS
By default, it displays the data type related to the column name. You may modify it as per the requirement.
For Example: If the Column Name is mentioned as Priority then by default, the Data Type will be displayed as Number.
Primary Key
Select this check box to define a field (or column) as Primary Key.
Note:
Primary keys should contain unique values and cannot have NULL values. If Primary Key has duplicate values it will be highlighted during validation checks.
Mandatory
Select the Mandatory checkbox to indicate if the associated column is the mandatory column.
Note:
If Mandatory Key has null value or left empty then it will be highlighted during validation checks.
Autogenerate?
Autogenerate? field is displayed only if Data Type is Number or Integer.
If Autogenerate? checkbox is selected it indicates that the value for the column will be populated automatically as the records are entered and in the series of the existing series.
Figure: Autogenerate?
For example:
If a new table is created and 5 records are being uploaded. The auto-generate column will get automatically populated from 1 to 5.If there is an already existing table with 10 records and 5 more records have to be added. Then the auto-generate column will automatically take the subsequent series i.e. 1 to 10 serial no. already exists. 5 new records will take 11 to 15.
PREVIOUS
Click PREVIOUS button to go back to the previous screen.
NEXT
Click NEXT button to proceed further.
CANCEL
Click CANCEL button to cancel the immediate action. It will redirects you to Web Service Designer page.
Click NEXT. The following popup is displayed:
Figure: Popup pageThe popup page is displayed with two options:
1. CONTINUE WITH THIS DATA - Click this option if you want to continue with the already existing data from the excel.
2. DOWNLOAD MASTER - Click this option if you want to download the excel template having the defined columns with the configured data types, and add the records in the excel template.If you click CONTINUE WITH THIS DATA then the PREVIEW page under the UPLOAD MASTER tab is displayed:
Figure: PREVIEWThe PREVIEW page displays all of the records which are imported via excel. There will be a few validation checks before you do bulk upload.
The following table describes a few validation checks while bulk uploading.Symbol
Meaning
If the data in the field does not match the data type mapped against that field, then it displays the data mismatch.
For Example: If you have defined Data Type for a column name NoofDays as an integer but the input value is Five (text string) then it's a data mismatch.
Mandatory columns can not be left blank.
For Example: If you have defined Data Type for a column name Employee ID as mandatory then this column can not be left blank.
In Excel data set if a single column which is mentioned as Primary Key has same values then that record is duplicate.
If a column is selected as Primary Key, then that column will become a unique identifier. This column can not have duplicate entries and will be identified during validation checks.
For Example: If you have defined Data Type for a column name Employee ID as primary then this column can not have duplicate entries.
Field DescriptionThe following table describes the fields on the PREVIEW page:
Fields
Description
Discard
Select the Discard checkbox to indicate that the selected record will not be included while upload.
Column
Displays all columns names which are imported via excel.
PREVIOUS
Click PREVIOUS button to go back to the previous screen.
BULK UPLOAD
Click BULK UPLOAD button to upload all the records displayed on PREVIEW tab.
CANCEL
Click CANCEL button to cancel the immediate action. It will redirects you to Web Service Designer page.
Click BULK UPLOAD. The following popup is displayed with total count of records, count of uploaded records and count of failed records.
Figure: BULK UPLOAD popup
Download failed records - Click Download failed records to download the excel with failed records which were failed to upload. You can make corrections to the records and upload again.
OK & Proceed - Click OK & Proceed button will direct to the Table List Screen with the table having the records which are uploaded. A sample screenshot is as follows:
Note:
Ensure that the Excel file being uploaded is not the Excel file downloaded from the Summit AI Report.
Ensure that first row of Excel file to be uploaded is the column name (A1 Cell). Uploading data values should start from the second row onwards (A2 Cell).
To achieve optimal performance, keep number of rows/entries under 2000 for the Excel file being uploaded.