SOAP Service
Purpose
Define a service to interact with SOAP APIs.
Prerequisites
None
Configuration
Name & Description
-
Name
: Name of the Asset. Spaces are not allowed in the name. -
Description
: Enter a description.
The Asset Usage
box shows how many times this Asset is used and which parts are referencing it.
Click to expand and then click to follow, if any.
Required roles
In case you are deploying to a Cluster which is running (a) Reactive Engine Nodes which have (b) specific Roles
configured, then you can restrict use of this Asset to those Nodes with matching
roles.
If you want this restriction, then enter the names of the Required Roles
here. Otherwise, leave empty to match all
Nodes (no restriction).
SOAP Service Settings
Configure the parameters for your SOAP Service:
WSDL
WSDL (Web Service Description Language), an XML based definition language, is required to describe the functionality of the SOAP based web service which should be configured in this Service Asset.
WSDL location
: Provide a web address respectively source directory where to find the WSDL.Configuration file directory
: Only required in case the WSDL location is based in a source directory.Override Service URL
: Only required in case you want to configure a specific Service URL appearance to connect to this service.
Web-based WSDL
Source directory WSDL
Credentials
You have three options to authenticate against the SOAP service endpoint:
- None
- Username and Password
- Username and Secret
None
No authentication is performed / required.
Username and Password
-
Credential Type
: SelectUser/Passsword
from the drop-down box. -
Username
(macro supported): Your username. -
Password
(macro supported): Your SOAP Service password. -
Do not substitute macro terms in password
: Check this box, if your password contains wording which could be mistaken as a macro (${...}
) but should not be replaced by layline.io.
Username and Secret
-
Credential Type
: SelectUser/Secret
from the drop-down box. -
Username
(macro supported): Your username. -
Secret
: Select aSecret
from the drop-down list. If the list is empty, then you need to first create a secret to be able to assign it here.Please follow this link to "Advanced Concepts" to learn about the concept and use of the Security Storage.
Operations
The following parameters will automatically be available in drop-down lists as soon as the above WSDL configuration has successfully been provided.
Choose the SOAP service name
and the appropriate Binding
required for the Service Asset from the drop-down lists.
In case the drop-down list does not automatically offer the available services, then please save, close and reopen the project for re-initialization.
All available service operation functions available through the WSDL will automatically show up.
Example: Using the SOAP Service
The SOAP Service can be used from within a JavaScript Asset. In our example we have a simple Workflow which reads a file with input data (1), then in the next step (2) requests data from a SOAP service to enrich the incoming data, and outputs the enriched messages to an output file. There is no other purpose in this Workflow than to demonstrate how to use the Service.
In the middle of the Workflow we find a JavaScript Processor by the name of “Enrich-SOAP-Data”. This Processor reads information from a configured SOAP Service.
How is it configured?
Link Enrich-SOAP-Data Processor to SOAP Service
To use the SOAP Service in the JavaScript Processor, we first have to assign the Service within the JavaScript Processor like so:
-
Physical Service
: The SOAP Service which has been configured. -
Logical Service Name
: The name by which we want to use the Service within JavaScript. This could be the exact same name as the Service or a name which you can choose. Must not include whitespaces.
Access the Service from within JavaScript
Now let’s finally use the service within JavaScript:
Reading from SOAP endpoint
Example: services.SOAPService.CountryName(countryCode)
let soapResponse = null; // will receive the SOAP data
let countryCode = null;
if (message.data.SMPL_IN.RECORD_TYPE == 'D') {
countryCode = message.data.SMPL_IN.COUNTRY_ISO;
try {
// Invoke service function.
soapResponse = services.SOAPService.CountryName(countryCode);
} catch (error) {
// handle error
}
// map response return value towards output
if (soapResponse && soapResponse.data.length > 0) {
message.data.SMPL_OUT = {
RECORD_TYPE : message.data.SMPL_IN.RECORD_TYPE,
FILE_NAME : filename,
DATE : message.data.SMPL_IN.DATE,
DESCRIPTION : message.data.SMPL_IN.DESCRIPTION,
CREATE_DATE : DateTime.now(),
COUNTRY_NAME : soapResponse.data
}
} else {
message.data.SMPL_OUT = {
RECORD_TYPE : message.data.SMPL_IN.RECORD_TYPE,
FILE_NAME : filename,
DATE : message.data.SMPL_IN.DATE,
DESCRIPTION : message.data.SMPL_IN.DESCRIPTION,
CREATE_DATE : DateTime.now(),
COUNTRY_NAME : "UNKNOWN"
}
}
stream.emit(message, OUTPUT_PORT);
}
Service Testing
layline.io provides a test facility for testing your Services before you deploy them. In this way, you save time and effort by testing your Services without having to deploy and activate a whole Project with Workflows.
Once you have configured your Service(s), you can test them:
Within your Asset Configuration tab (1), switch to the Test
tab (2) to test your Service.
Test Facility Toolbar
The toolbar provides the following options:
The Testing tab provides two major views:
- Testcase configuration: This is where you define the testcases to be executed.
- Testcase execution: This is where you can execute the testcases and see the results.
You switch between these two views by clicking on the leftmost icon in the toolbar (1).
Let's start with the Testcase configuration view.
Testcase Configuration
The concept of the Testing is to define a set of Testcases which can be executed in a batch or individually. For this purpose, you can define multiple Testcases and configure them individually. I.e. each Testcase groups a number of indidivual tests which can be executed individually or in a batch.
Adding a Testcase
Click Add Testcase
in the toolbar to add a new testcase:
A new Testcase is added.
It is automatically named New<Service Asset Name>Test
(3) and added to the list of Testcases (2).
Service test name
(3): You can change the name of the Testcase here.Service test description
(4): You can add a description to the Testcase here.
Test Case Setup
Basics
In this section you define the individual tests to be executed for this Testcase.
To start, click # END
in the toolbar:
A new test is added to the list of tests (1), and the test is opened for configuration (2).
Next we fill in the details:
-
Test name
(3): You can change the name of the Test here. -
Test description
(4): You can add a description to the Test here. -
Service function to test
(5): Select the Service function to test here.This list contains all Service functions which are defined in the Service Asset. Pick the one you want to test.
Once a Service function is selected, the system will automatically create a skeleton to fill in the respective parameters for the selected Service function.
Service Function Input Parameters
-
Service Function Input Parameters
(6): Fill in the respective parameters for the selected Service function.In our example we have a function
GetAlertsForSite
which takes two parametersbaseurl
andriskId
. If we click onAdd member
in the skeleton table the system will allow you to select the respective parameter from the list of available parameters:Once you have selected the parameter, the system will automatically add the respective parameter name. You then add the respective value for the parameter:
Service Function Evaluation Parameters
To automatically evaluate the result, you can add a script which analyzes the results.
Testcase Execution
Once you have configured your Testcases, you can execute them.
There are two ways on how to trigger execution:
-
Option 1: Select
Run selected test
in the toolbar (1) to execute the currently selected Testcase.Executing a test this way will switch the tab to the Testcase execution view, execute the test and show the results.
-
Option 2: Switch to the Testcase execution view by clicking on the leftmost icon in the toolbar (1) select the test to execute, and then hit the
play
button next to the test.
Each option will take us to the Testcase execution view:
In this view you can find the Testcase
(1) and the Tests
(2) we have created.
If we had created additional tests for this Testcase, they would be listed here as well.
Question marks indicate that the test has not yet been executed.
We can now either execute all tests, or run them individually:
-
Run all Tests
(1): Click this button to execute all tests. -
Run Testcase
(2): Click this button to a Testcase with all its underlying individual tests. -
Run individual Test
(3): Click this button next to a test to execute this individual test.
Once a test has been executed, the question mark will be replaced by a green check mark or a red cross depending on whether the test was successful or not.
The right hand-panel will show the results of the test execution respectively:
In case of errors, the system will show the error message for further investigation.
Please note, that the creation of the online documentation is Work-In-Progress. It is constantly being updated. should you have questions or suggestions, please don't hesitate to contact us at support@layline.io .