Online Data Provider: JavaScript (example with process described)

Query a SOAP web service

 

Here will be described an example of how to get data from a web service using the JavaScript data driver on example Nextraq.

 

Preparation

 

Need to know:

  • Service location (from documentation)
  • WSDL location (from documentation). Not required but will help a lot.
  • Operation name
  • XML request body.

To get data from web service you need

  • send POST request to the (1) address
  • with header “soapaction” : “OPERATION_NAME”
  • and correct XML request for you query.

 

Extracting all necessary information

We will try to get an auth token. We need page 8 in documentation.

Service location address will be

To get an operation name we need to navigate to a WSDL location address

To get the XML Body we will use WcfTestClient.exe

  • Open WcfTestClient.exe
  • File -> Add Service
  • Type WSDL location

  • Press OK
  • You should get smth like that

Select “getAuthenticationToken”

In the right column fill data that you need. (username and password)

 

  • And at the bottom select XML tab to see the XML body that you need.

Let’s open the Postman ant check if it’s working. Fill in everything in red with the data you received earlier

 

 

 

Press "Send" button.  If everything is OK – you should get the XML response body with your data.

 

Writing the Java Script code

Below refers to attached java script (soap example.txt):

 

Here is an example that retrieve auth token and using this token query GetLocationGroupDetails endpont.

Line 16, 17 - type your credentials

Line 31 - main function that query Web Service and returns response in JSON format.

Line 43 - Retrieving the auth token.

Lines 68-95 - Code that you need to modify

On line 95 you can process your data as you want

Creating Data Source

Copy code above to the Data Discovery (or ETL) JavaScript data source. 

Set the custom query for data source:

Press save and enjoy your data!

 

 

 

 

 

 

 

 

 

 

 

 

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.