Creating a Web Service Connection

To create a Web Service connection, perform the following steps:

  1. In Sigma Studio, click Create > Connection.



    The Create New Connection page appears.



  2. In the Create New Connection page, page, provide an unique name for the connection in the Connection Name field.
  3. In the Connection Type field, click Web Service.
  4. Enter the REST web service address ending with a forward slash in the Domain Name field. This address is also called as the base URL.
  5. Select the industry-standard authorization mechanism supported by the REST web service from the Authentication Type drop-down list. The available options are as follows:
    1. No AuthenticationIf No Authentication is the authentication type, proceed to step 8. Refer No Authentication for more information.
    2. OAuth 2. If OAuth 2 is the authentication type, proceed to step 6. Refer OAuth 2 for more information.
    3. API Key. If API Key is the authentication type, proceed to step 7. Refer API Key for more information.
  6. If OAuth 2 is the authentication type, perform the following steps in the OAuth Connection Details section, else proceed to step 7.
    1. Enter the field name in which the access token will be passed to the web service in the Access Token Key field.

      Each Web service will slightly vary in terms of the registration, authorization code and access token generation process.


    2. Enter the Java class to provide the access token to the web service in the Access Token provider field.

      The Java class that you provide must implement the IRestServiceAccessTokenProvider interface.


      For your understanding, a sample Java class to obtain the access token is as follows:

      package com.intellectdesign.canvas.webservice;
      public class SampleRestAccessTokenProvider implements IRestServiceAccessTokenProvider 
      {
      	private String accessTokenFromService;
      	
      	public SampleRestAccessTokenProvider() { }
      
      	@Override
      	public String getAccessToken(String connectionName, String domainName) 
      	{
      		/*
      		* Implementation teams are expected to override this method and return
      		* the access token secured from the web service. Its assumed that
      		* implementation team takes care of the steps involved in getting an 
      		* access token from a target web service secured using OAuth mechanism.
      		*/ 
      		return accessTokenFromService;
      	}
      }


    3. Proceed to step 8.
  7. If API Key is the authentication type, perform the following steps in the API Key Connection Details section, else proceed to step 8.
    1. Enter the field name in which the API key will be passed to the web service in the API-Key Key word field.

      Each Web service will slightly vary in terms of the third party application registration process.


    2. Enter the value of the API key in the API-key field. This is the value that was provided by the web service provider to allow access to the data.

      Each Web service will slightly vary in terms of the third party application registration process.


    3. Proceed to step 8.
  8. To specify certain conditions to fetch data from the web service, perform the following steps in the JSON Configuration for Request section, else proceed to step 9.

    The fields in this section (Model Id, Model Name, Model Description) and the JSON fields (step 8d) can be used when a base URL (application) offers many web services and the data from each of these web services must be fetched based on certain JSON conditions. Each web service will expect the JSON payload request in a particular format and will expose the format to the third party applications. Therefore, you must know the payload request format expected by the web service to write the JSON conditions accordingly. The conditions can be static, dynamic or a combination of both. Basically, using these fields, the master JSON is split into multiple models (conditions such as pagination, sorting, filtering, and so on).

    1. Enter a unique ID for the logical blocks within the JSON in the Model Id field.
    2. Enter a name for the JSON block in the Model Name field.
    3. Enter a description for the JSON block condition in the Model Description field.
    4. In the right pane, provide the JSON for the conditions to fetch data from the web service.

      For example, let's assume a web service called finance is available at http://1.2.3.4:0101/ShreeFinancials/rest/finance/postfetch. We have three conditions – pagination, sorting and filtering based on which the data will be fetched from the finance web service. We can split these conditions into three different models and provide them in the right pane of the section as shown in the following image. These models can be reused for other data sources (Web services) of the same connection.



      As shown in the example, to paginate the data, the JSON can be provided as follows:

      {
      	"start":"$page.start",
      	"maxNumOfRecords":"$page.size"
      } 


      To sort the data, the JSON can be provided as follows:

      {
      	"sortFields":
      	[{
      		"fieldName":"$sort.field",
      		"direction":"$sort.direction"
      	}]
      }


      To filter the data, the JSON can be provided as follows:

      {
      	"filters":
      	[{
      		"level":"$filter",
      		"$key":"runtimeFilters",
      		"columnValue":"value1",
      		"type":"string",
      		"columnName":"fieldName"
      	}]
      }

      Each web service will expect the payload request to be sent in a particular format. You must know the payload request format expected by the Web service to write the JSON conditions accordingly.

    5. To add another JSON block, click Add and follow the steps 8a to 8d. Proceed to next step to continue.
  9. Click Save.
    Once the connection is saved correctly, the following message appears.


Watch the following videos for more information.

Configuring API Key Based Web Service


Configuring No Auth Based Web Service


Web Service Integration via Internet Proxy



See also:


Copyright © Intellect Design Arena Limited.

All rights reserved. These materials are confidential and proprietary to Intellect Design Arena Limited and no part of these materials should be reproduced, published in any form by any means, electronic or mechanical including photocopy or any information storage or retrieval system nor should the materials be disclosed to third parties without the express written authorization of Intellect Design Arena Limited.