This article explains how to connect to a SOAP/XML web service: RiksBank services - getCalendarDays and the steps necessary to build a flow from RiksBank (GetCalendarDays) to Amazon S3 (XPath).
Caution: NetSuite SOAP web services do not return formula fields in saved search requests. Use RESTlets to return formula fields from NetSuite.
Note: For Amazon S3, you can either create a free account or replace it with an SSH File Transfer Protocol (SFTP) server if you have one available.
Create the connections
If you haven't already done so, create the connections in integrator.io to each system.
RiksBank
Set up a connection with the following values:
- Name: RiksBank SOAP Service
- Authentication Type: Basic
-
Configure HTTP Headers:
- Connection: Keep-Alive
- Content Type: application/soap+xml;charset=UTF-8;action="urn:getCalendarDays"
- Accept-encoding: gzip,deflate
-
Base URI
https://swea.riksbank.se:443/sweaWS/services/SweaWebServiceHttpSoap12Endpoint
- Media type: XML
- Username: x (This is not explicitly needed so you can use any value.)
- Password: x (This is not explicitly needed so you can use any other value.)
Test connection
Use the following ping request to test the connection:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://swea.riksbank.se/xsd">
<soap:Header/>
<soap:Body>
<xsd:getCalendarDays>
<datefrom>2012-10-01</datefrom>
<dateto>2012-10-03</dateto>
</xsd:getCalendarDays>
</soap:Body></soap:Envelope>
Make sure you get a success response when you test the connection.
Amazon S3
Set up a connection with the following values:
- Name: Amazon S3
- Access Key ID: Get this from your Amazon Web Services account, as described on stackoverflow.com)
- Ping Bucket: celigo-io (If a bucket doesn't exist, create one.)
Flow: RiksBank (GetCalendarDays) to Amazon S3 (XPath)
In this section, we'll build the flow to take calendar details from RiksBank, convert the payload to JSON, and put that into a file on S3.
Below is a visual representation of the final result of the flow:
Step 1: Define the Export
Define the export to get the data from the web service, as below.
Pay close attention to the Resource Path as it is the key part that tells the platform how to convert the response XML to an equivalent (basic) JSON payload. For an example of what the response looks like in XML, see RiksBank documentation.
- Name: RiksBank : Get Calendar Days
- HTTP Method: POST
- Content-Type: application/soap+xml;charset=UTF-8;action="urn:getCalendarDays"
- Success media type: XML
- Error media type: XML
- Resource path:
/*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='getCalendarDaysResponse']
Configure the HTTP Request Body as shown below.
Note the use of JSON handlebars notation to add dynamic bits to the payload, in this case the dateFrom and dateTo. For more information on how to use the built-in handlebars helpers (such as dateFormat and dateAdd), see Handlebar helper reference.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://swea.riksbank.se/xsd">
<soap:Header/>
<soap:Body>
<xsd:getCalendarDays>
<datefrom>{{dateFormat "YYYY-MM-DD" (dateAdd (timeStamp) "-259200000")}}</datefrom>
<dateto>{{dateFormat "YYYY-MM-DD" timeStamp}}</dateto>
</xsd:getCalendarDays>
</soap:Body>
</soap:Envelope>
If you click Preview, the integrator.io will make a call to the web service that returns the following response:
{ "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://www.w3.org/2003/05/soap-envelope\">
<SOAP-ENV:Body>
<ns0:getCalendarDaysResponse xmlns:ns0=\"http://swea.riksbank.se/xsd\">
<return xmlns=\"\">
<bankday xmlns=\"\">Y</bankday>
<caldate xmlns=\"\">2020-05-19</caldate>
<week xmlns=\"\">21</week>
<weekyear xmlns=\"\">2020</weekyear>
</return>
<return xmlns=\"\">
<bankday xmlns=\"\">Y</bankday>
<caldate xmlns=\"\">2020-05-20</caldate>
<week xmlns=\"\">21</week>
<weekyear xmlns=\"\">2020</weekyear>
</return>
<return xmlns=\"\">
<bankday xmlns=\"\">N</bankday>
<caldate xmlns=\"\">2020-05-21</caldate>
<week xmlns=\"\">21</week>
<weekyear xmlns=\"\">2020</weekyear>
</return>
<return xmlns=\"\"><bankday xmlns=\"\">Y</bankday>
<caldate xmlns=\"\">2020-05-22</caldate>
<week xmlns=\"\">21</week>
<weekyear xmlns=\"\">2020</weekyear>
</return>
</ns0:getCalendarDaysResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>", "url": "https://swea.riksbank.se:443/sweaWS/services/SweaWebServiceHttpSoap12Endpoint", "statusCode": 200 }
Step 2: Define the import
The next step is to define the import into S3:
- Name: Amazon S3 : Import JSON
- Region: Select the region where you have your AWS account.
- Bucket name: celigo-io (or the same one you used in the definition of the connection).
- File type: JSON
- File key: file-{{timestamp}}.json
Step 3: Define a transformation on the export
This step defines how integrator.io cleans (or transforms) the basic JSON payload (from step 1) into a more human-friendly structure. Below are the details of the transformation.
Export | Import |
return[*].bankday[*]._ | return[*].bankday |
return[*].caldate[*]._ | return[*].caldate |
return[*].week[*]._ | return[*].week |
return[*].weekyear[*]._ | return[*].weekyear |
Here's an example of what your end result should look like.
Use the dashboard and debugger to test the flow and correct any errors.
Comments
This is great Adel Haider, helped me set up connection for legacy SOAP connection for VoiceComm.
Please sign in to leave a comment.