How to use SSIS SOAP API Connector

Introduction

SOAP Connector can be used to consume data from XML SOAP Service without any programming. It supports advanced filtering and a flexible approach to configuring request parameters for web services.

This connector can integrate SOAP API data inside SSIS and SQL Server. Let’s examine the steps below to see how exactly to accomplish that.

Prerequisites

Concepts

  • What is SOAP Web Service?: If you are new to SOAP Web Service sometimes referred as XML Web Service then please read some concept about SOAP Web service standard from this link

  • What is WSDL?: WSDL (often pronounced as whiz-dull) is nothing but a document which describes Service metadata (e.g. Functions you can call, Request parameters, response structure etc). Some service simply give you WSDL as xml file you can download on local machine and then analyze or sometimes you may get direct URL (e.g. http://api.mycompany.com/hr-soap-service/?wsdl )

  • What is a Service URL?: The service URL is the actual API URL you can call to get data.

  • Point before calling a SOAP service:
    *- Use correct service URL (Its not same as WSDL url). If you are unsure about the service URL, contact the API vendor or refer to API documentation.
    *. Find out how to pass credentials. It can be done via Basic Authorization or WSS Security Header in the Request body. Check this link to learn more
    *. Each service call you have to supply function you want to call. This can be done in 3 different ways.

    1. Pass via SOAPAction HTTP Header
    2. Pass via Url parameter or Url Path (http://myserver/service/function1http://myserver/service/?method=function1 )
    3. Pass via Request BODY

Steps

Using SoapUI to test SOAP API call / Create Request Body XML

If you do not have WSDL file or URL handy then contact your API provider (sometimes you just have to add ?wsdl at the end of your Service URL to get WSDL so try that. Example: http://mycompany/myservice?wsdl ).

If you don’t know what is WSDL then in short, WSDL is Web service Description Language (i.e. XML file which describes your SOAP Service). WSDL helps to craft SOAP API request Body for ZappySys XML Driver. So Let’s get started.

  1. Download and Install SoapUI (It’s a Free tool to test SOAP / REST Services)
  2. Open SoapUI and click SOAP button to create new SOAP Project
  3. Enter WSDL URL or File Path of WSDLFor example WSDL for our sample service can be accessed via this URL

http://www.holidaywebservice.com/HolidayService_v2/HolidayService2.asmx?wsdl
Create new SOAP API Project in SoapUI tool for SOAP API Testing

  1. Once WSDL is loaded, you will see possible operations, and you can call for your SOAP Web Service.

  2. If your web service requires credentials, you must configure it. There are two common credential types for public services (SOAP WSS or BASIC )

  3. To use SOAP WSS Credentials select the request node and enter UserId, Password, and WSS-PasswordType (PasswordText or PasswordHash)

  4. To use BASIC Auth Credentials select request node and double-click it. At the bottom click on Auth (Basic) and From Authorization dropdown click Add New and Select Basic

  5. Now you can test your request first Double-click on the request node to open request editor.

  6. Change necessary parameters, remove optional or unwanted parameters. If you want to regenerate request you can click on Recreate default request toolbar icon

  7. Once your SOAP Request XML is ready, Click the Play button in the toolbar to execute SOAP API Request and Response will appear in Right side panel.

  8. Once you have tested your SOAP API in SoapUI tool, we are ready to use ZappySys SSIS Tasks/Components or ODBC Drivers to call SOAP API in SSIS or your preferred BI tool or Programming language.

How to read data from SOAP in SSIS (Export data)

In this section we will learn how to configure and use Soap Connector in the API Source to extract data from the Soap.

  1. Launch SoapUI. Click on File menu and Select New SOAP Project

  2. Enter your WSDL file path or URL

  3. Click OK to create Project. This will create some dummy requests for you. If you want to see all available parameter in your Request you can create New Request by right click on Method node and select New Request. When prompted to create optional parameters then click yes.
    image

  4. Click on Request node as below and it will show you XML code for your SOAP request. You can edit parameters as needed. We will use this code in our XML Source to build SOAP Request. Some time your SOAP Service may require UserID/Password in SOAP Body or via Authorization Header like this one. If you passing credentials Authorization header then you can use ZS-HTTP connection (on XML Source UI check Use Credentials option and create new connection)

  5. Begin with opening Visual Studio and Create a New Project.

  6. Now, Drag and Drop SSIS Data Flow Task from SSIS Toolbox. Double click on the Data Flow Task to see Data Flow designer

  7. Drag and drop XML Source
    image

  8. While making a SOAP Request, you have to configure the following items in your XML Source.
    *.URL
    *.Request Method (e.g. POST)
    *.Headers
    *.Request Body (for request SOAP XML)

  9. Double-click XML Source to configure it.
    *. Set webservice URL
    *. Set request method to POST
    *. In the headers grid, click Raw Edit to add 2 more headers as below

Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://some-url-of-your-api-call"

image

  1. Now click on Edit option next to Body Textbox. You can Copy sample Request XML generated in SoapUI and paste in Request Data (See below screenshot). You have to make sure to include all required fields in your XML Request (You may create new XML request in SoapUI with include Optional fields Turned ON to see all parameters).

  2. XML Source supports using Placeholders in request URL, body and headers so its great way to make things dynamic. If you have need to use placeholders then you can use {Insert Variable} option like below screenshot and add variable anywhere in the text.

  3. You can also edit Filter to control how data is returned. If you have Nested nodes in XML response you can select data node which you care about. Click select Filter button to navigate through hierarchy.
    Filter SOAP Web Service - XML response data

  4. Un-check include parent option if you don’t care about getting parent attributes.

  5. Your final UI may look like below after setting Url, Method, Body and Headers.
    Calling SOAP Web Service in SSIS using XML Source Connector

  6. On Array handling tab you can type all the element names you know for sure that going to have one or more records. For example if your response looks like below you can enter a:row in the possible array fields on Array Handling tab. That way if you have just one record rather than multiple records Filter expression like this wont fail ( $.a:response.a:data.a:row[*] ) .

<a:response> 
   <a:data> 
       <a:row>....</a:row> 
       <a:row>....</a:row> 
    </a:data> 
</a:response>
  1. Now once all settings entered. Click Preview.
    Set Filter and Preview SOAP Web Service Response in Table Format

  2. That’s it; we are done. In a few clicks we configured the call to Soap using ZappySys Soap Connector

Video Tutorial

Conclusion

You can now use our SSIS SOAP API connector. For any issues or further assistance, please contact our support team via chat on our website.

References