Suomi.fi for Service Developers
Go directly to contents.

Data Exchange Layer test services

The article describes the Data Exchange Layer test services that you can use to check the success of the security server installation and test the sending of SOAP messages and REST requests corresponding to the X-Road communication protocol and the processing of responses to them.

The format of the client interface through which the security server calls the services of the Data Exchange Layer is https://{host}/. The {host} part of the address must be replaced with the hostname of the organisation’s own security server.

Please note! Using IP addresses in the calls is not recommended, since it causes problems with the certificates. The problems occur if the hostname used in the call to the security server does not correspond to the hostname stated in the certificate of the security server.

See also the following technical descriptions:

Testing of SOAP messages

In the requests sent to the security server, the value of the Content-Type header must be text/xml and the HTTP method must be POST.

URL: https://{host}/
Method: POST
Content-Type: text/xml

See the API Catalogue for descriptions of the SOAP test servicesOpens in a new window..

getRandom

The GetRandom service does not contain call parameters. In its response, it returns a random integral number between 0 and 100.

Testing with Curl command line program

The getRandom service is also well-suited for tests with Curl command line program. Just give the following command:

curl -k -d @getRandom.xml --header "Content-Type: text/xml" -X POST https://{host}/

The Curl command uses the k optionOpens in a new window., which means that the certificate of the called service will not be verified.

SOAP message used in calls for getRandom service

The SOAP message used to call the getRandom service is presented below. You must replace the Client block contents marked with X with the subsystem details added under your own organisational ID. The Data Exchange Layer environment (FI-DEV, FI-TEST or FI) in which the SOAP message is to be tested must also be set in the element.

Request:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xro="http://x-road.eu/xsd/xroad.xsd"
xmlns:iden="http://x-road.eu/xsd/identifiers"
>
<soapenv:Header>
<xro:client iden:objectType="SUBSYSTEM">
<iden:xRoadInstance>FI-TEST</iden:xRoadInstance>
<iden:memberClass>XXXX</iden:memberClass>
<iden:memberCode>XXXX</iden:memberCode>
<iden:subsystemCode>XXXX</iden:subsystemCode>
</xro:client>
<xro:service iden:objectType="SERVICE">
<iden:xRoadInstance>FI-TEST</iden:xRoadInstance>
<iden:memberClass>GOV</iden:memberClass>
<iden:memberCode>0245437-2</iden:memberCode>
<iden:subsystemCode>TestService</iden:subsystemCode>
<iden:serviceCode>getRandom</iden:serviceCode>
<iden:serviceVersion>v1</iden:serviceVersion>
</xro:service>
<xro:id>ID11234</xro:id>
<xro:userId>test</xro:userId>
<xro:protocolVersion>4.0</xro:protocolVersion>
</soapenv:Header>
<soapenv:Body>
<prod:getRandom xmlns:prod="http://test.x-road.global/producer" />
</soapenv:Body>
</soapenv:Envelope>

Example response:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:iden="http://x-road.eu/xsd/identifiers" xmlns:xro="http://x-road.eu/xsd/xroad.xsd">
<soapenv:Header>
<xro:client iden:objectType="SUBSYSTEM">
<iden:xRoadInstance>FI-TEST</iden:xRoadInstance>
<iden:memberClass>XXXX</iden:memberClass>
<iden:memberCode>XXXX</iden:memberCode>
<iden:subsystemCode>XXXX</iden:subsystemCode>
</xro:client>
<xro:service iden:objectType="SERVICE">
<iden:xRoadInstance>FI-TEST</iden:xRoadInstance>
<iden:memberClass>GOV</iden:memberClass>
<iden:memberCode>0245437-2</iden:memberCode>
<iden:subsystemCode>TestService</iden:subsystemCode>
<iden:serviceCode>getRandom</iden:serviceCode>
<iden:serviceVersion>v1</iden:serviceVersion>
</xro:service>
<xro:id>ID11234</xro:id>
<xro:requestHash algorithmId="http://www.w3.org/2001/04/xmlenc#sha512">
Doc7YT1KNpgupOTaQP+6yN2n+wEJntryCPa6i40zGIRudZf3HSgrwiZuQuB+pKJwRx2V5rsr0L/jOmaV9o9n8Q==
</xro:requestHash>
<xro:userId>test</xro:userId>
<xro:protocolVersion>4.0</xro:protocolVersion>
</soapenv:Header>
<soapenv:Body>
<ts1:getRandomResponse xmlns:ts1="http://test.x-road.global/producer">
<ts1:data>42</ts1:data>
</ts1:getRandomResponse>
</soapenv:Body>
</soapenv:Envelope>


helloService

The helloService contains the name call parameter and in its response, it returns the greeting assigned to the name given as the name parameter value.

Testing with Curl command line program

The helloService is also well-suited for tests with Curl command line program. Just give the following command:

curl -k -d @helloService.xml --header "Content-Type: text/xml" -X POST https://{host}/

The Curl command uses the k optionOpens in a new window.. In such cases, the certificate of the called service will not be verified.

SOAP message used to call the helloService

The SOAP message used to call the helloService is presented below. You must replace the Client block contents marked with X with the subsystem details added under your own organisational ID. The Data Exchange Layer environment (FI-DEV, FI-TEST or FI) in which the SOAP message is to be tested must also be set in the element.

Request:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xro="http://x-road.eu/xsd/xroad.xsd"
xmlns:iden="http://x-road.eu/xsd/identifiers"
>
<soapenv:Header>
<xro:client iden:objectType="SUBSYSTEM">
<iden:xRoadInstance>FI-TEST</iden:xRoadInstance>
<iden:memberClass>XXXX</iden:memberClass>
<iden:memberCode>XXXX</iden:memberCode>
<iden:subsystemCode>XXXX</iden:subsystemCode>
</xro:client>
<xro:service iden:objectType="SERVICE">
<iden:xRoadInstance>FI-TEST</iden:xRoadInstance>
<iden:memberClass>GOV</iden:memberClass>
<iden:memberCode>0245437-2</iden:memberCode>
<iden:subsystemCode>TestService</iden:subsystemCode>
<iden:serviceCode>helloService</iden:serviceCode>
<iden:serviceVersion>v1</iden:serviceVersion>
</xro:service>
<xro:id>ID11234</xro:id>
<xro:userId>test</xro:userId>
<xro:protocolVersion>4.0</xro:protocolVersion>
</soapenv:Header>
<soapenv:Body>
<prod:helloService xmlns:prod="http://test.x-road.global/producer">
<prod:name>Erkki Esimerkki</prod:name>
</prod:helloService>
</soapenv:Body>
</soapenv:Envelope>

Example response:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:iden="http://x-road.eu/xsd/identifiers" xmlns:xro="http://x-road.eu/xsd/xroad.xsd">
<soapenv:Header>
<xro:client iden:objectType="SUBSYSTEM">
<iden:xRoadInstance>FI-TEST</iden:xRoadInstance>
<iden:memberClass>XXXX</iden:memberClass>
<iden:memberCode>XXXX</iden:memberCode>
<iden:subsystemCode>XXXX</iden:subsystemCode>
</xro:client>
<xro:service iden:objectType="SERVICE">
<iden:xRoadInstance>FI-TEST</iden:xRoadInstance>
<iden:memberClass>GOV</iden:memberClass>
<iden:memberCode>0245437-2</iden:memberCode>
<iden:subsystemCode>TestService</iden:subsystemCode>
<iden:serviceCode>helloService</iden:serviceCode>
<iden:serviceVersion>v1</iden:serviceVersion>
</xro:service>
<xro:id>ID11234</xro:id>
<xro:requestHash algorithmId="http://www.w3.org/2001/04/xmlenc#sha512">
NcckU0J6OXU88GxhsNH/4/CZlunAscUl+Xi65CBQe6dO+yiSubms1RssbLRSarh/LfwaGkJuiIQrm7fARRtoFg==
</xro:requestHash>
<xro:userId>test</xro:userId>
<xro:protocolVersion>4.0</xro:protocolVersion>
</soapenv:Header>
<soapenv:Body>
<ts1:helloServiceResponse xmlns:ts1="http://test.x-road.global/producer">
<ts1:message>Hello Erkki Esimerkki! Greetings from adapter server!</ts1:message>
</ts1:helloServiceResponse>
</soapenv:Body>
</soapenv:Envelope>Testning av REST-tjänster


Testing REST services

GET rest-test/random

The rest-test/random service does not contain call parameters. In its response, it returns a random integral number between 0 and 100.

Testing with Curl command line program

You can use the Curl command line program and the below example query to easily test the service. In the example, you must replace the Client contents marked with X with the subsystem details added under your own organisation code. The FI-TEST environment has been used in the example, but you can use the name of the Data Exchange Layer environment (FI-DEV, FI-TEST or FI) in which you want to test the REST message instead. 

The Curl command uses the k optionOpens in a new window.. In such cases, the certificate of the called service will not be verified.

Query

curl -k -H 'X-Road-Client: FI-TEST/XXXX/XXXX/XXXX' -H 'accept: application/json'  -i 
https://{host}/r1/FI-TEST/GOV/0245437-2/TestService/rest-test/random 

Example response

HTTP/1.1 200
Date: Wed, 13 Dec 2023 09:53:47 GMT
Content-Type: application/json
x-road-id: FI-TEST-e6821729-a81d-49a8-a807-56a9bec0c022
x-road-client: FI-TEST/XXXX/XXXX/XXXX
x-road-service: FI-TEST/GOV/0245437-2/TestService/rest-test
x-road-request-id: 558e8c41-fbe9-4370-941f-b802f11e5615
x-road-request-hash: wH7FYkzHW1T/1mBaGgTXAjZV1kBCJkjmxBa58JntVZ2Imc4qmjXOHoY4WHO5uZczGxxuWJqVKsCiBkfEmm9ytg==
Content-Length: 11
{"data":11}

GET rest-test/hello

A name value can be given as a query parameter to the rest-test service. In its response, the service returns the greeting assigned to the name given as the name parameter value.

Testing with Curl command line program

To test the service, you can use for example the Curl command line program and the below example query. In the examples, the Client contents marked with X must be replaced with the subsystem details added under your own organisation code.

The FI-TEST environment has been used in the example and you can use the name of the Data Exchange Layer environment (FI-DEV, FI-TEST and FI) in which you want to test the REST message instead. The Curl command uses the k optionOpens in a new window.. In such cases, the certificate of the called service will not be verified.

Query

curl -k -H 'X-Road-Client: FI-TEST/XXXX/XXXX/XXXX' -H 'accept: application/json'  -i 
https://{host}/r1/FI-TEST/GOV/0245437-2/TestService/rest-test/hello?name=Erkki%20Esimerkki

Example response

HTTP/1.1 200
Date: Wed, 13 Dec 2023 12:05:34 GMT
Content-Type: application/json
x-road-id: FI-TEST-0cc79ae0-2cce-4593-9345-8297a8585d5f
x-road-client: FI-TEST/GOV/0245437-2/TestClient
x-road-service: FI-TEST/GOV/0245437-2/TestService/rest-test
x-road-request-id: 5a703f7b-2cfc-4e94-8e52-c9b749631a2f
x-road-request-hash:
slYoi7VWZdpPBiPawebuBMbkFRP29cGylqkZb2lxYdOxc5xPb5cKn6MWnLyJ2UaJchJ5PQ83/uX8bfDgdzeGIw==
Content-Length: 67
{"message":"Hello Erkki Esimerkki! Greetings from adapter server!"}

Updated: 28/10/2024

Are you satisfied with the content on this page?