In order to be able to communicate via web service with remote APIs, it is necessary to preconfigure these APIs in the server configuration of iXPath.

To make this configuration, you have to create a form of type IXWebServiceServer tracking type that allows you to insert a tracking or a remote config. The tracking type iXWebServiceServer is composed of several fields defined as follows : 

  • configName : The name of the configuration will be visible in the 'webservice' connector configuration of the scenario.
  • ipHost : The IP address or the host of the remote API.
  • uri : The URI that will be concatenated with the IP/Host address to form the complete URL.
  • method : The type of method: POST, GET...
  • port : The listening port of the API, 80 by default for HTTP protocols and 443 for HTTPS protocols.
  • protocol : http or https
  • authenticationMode : iXPath currently supports two authentication modes:
    • basic: This mode involves putting the username and password in the header encoded in base64. In this case, the 'AuthMode' tag requires three attributes: the header name 'header', the username 'user', and the password 'password.'
    • token: This mode involves putting a token in the header, which contains encoded information encrypted with a unique key using the HASHMAC algorithm. (The most popular example is JWT).
  • user and password: In the case of Basic authentication, the username and password must be provided.
  • token: In the case of Token authentication, the 'Token' parameter can be provided.
  • timeout: The timeout for the REST request.

It is noted that all these parameters can be overloaded in the web service envelope, which we will detail in the following chapter.

THE WEBSERVICE CONNECTOR

The 'webService' connector allows you to send messages to remote REST APIs. The connector can be found in the 'Communication' palette of the 'Scenario' view.

1699439870326-996.png

1699439898879-165.png

Before starting the configuration of this connector, let's clarify the concept of the wrapped message.

ENVELOPE :

The message sent to the remote WebService is constructed of two parts: the envelope and the message. The envelope contains additional information to be transferred to the WebService (such as the name of the sender...), and it may also contain other information related to iXPath. Let's analyze the example below :

1699440082967-836.png

The envelope can contain a reference to the message, here are the possible cases:

  • %DATA%: The message file will be inserted into the %DATA% reference as it is.

  • %DATA64%: The message file will be inserted after being encoded in base64.
  • %DATAZIP64%: The message file will be inserted after being zipped and encoded in base64

NB2: After inserting the message into the envelope, the final message must be in JSON format, otherwise an error will be generated!

LA CONFIGURATION DU WEB SERVICE:

The 'WebService' connector is configured as follows:

1699440442131-382.png

  • Config: The preconfigured remote web service configuration.
  • Dynamic Envelope: Specifies whether the envelope is dynamic or not:
    • Dynamic Envelope: Specifies that the envelope comes from a dynamic file (which will be generated globally by the 'XMLToBIN' connector, which we will detail later in the documentation).
    • Non-dynamic Envelope: Specifies that the envelope comes from a previously uploaded static file.
  • Envelope: Two cases arise:
    • If the envelope is dynamic: Then the parameter becomes a text field to specify the name of the connector that we want to consider as an envelope (usually an 'XMLToBIN
    •  If the envelope is non-dynamic: Then the field becomes an input for uploading a static envelope file.
  • Data: Refers to the name of the connector in order to integrate the output file into the %DATA% of the envelope. If the envelope contains the value '%DATA64%', then the output file will be encoded and integrated into the envelope. The same goes for the value '%DATAZIP64%' (zipped and encoded).

The 'WebService' connector returns a file containing the response from the REST call made.

 

Tags:
Created by hamza bayoud on 2023/11/08 11:37
    
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian