Search This Blog

2026-04-01

SAP Data Services Web Service (SOAP) Calling - Example

Product: SAP Data Services
Version: 4.2.x - 4.3.x

Overview

SAP BODS (Data Services) has DSMC browser GUI which offers web service functionality.  This allows external scheduler to easily integrate with it.

This blog post is going to show using PowerShell Invoke-WebRequest, so that you can see its  SOAP communication in low level.  For experience person, it should be easy to figure out how to configure the external job scheduler to use BODS WSDL 2.1 web service (SOAP) call.

For this example, I'm using following dummy value to illustrate

  • BODS URL: http://localhost:8080/DataServices/servlet/webservices?ver=2.1
  • Server hostname: localhost
  • Authentication Method: Build in Enterprise
  • Username: administrator
  • Password: hidden_hash_value
  • Job Server local repository name: LOCAL_REPO_DEV1
  • Job ID: 2
  • Going to simulate the OOTB web service call Get_BatchJob_Status, which will return 2 values of whether the web service call success or not (0=success), as well as job status in string of Running/Succussed/Error/Warning
    • BODS doc: https://help.sap.com/docs/SAP_DATA_SERVICES/ab33122a997f40d89e340549ff0bced8/5748962b6d6d1014b3fc9283b0e91070.html
Login is required to obtain session ID.  The session ID going to be used in subsequent web service call

For full SAP BODS web service reference doc, see https://help.sap.com/docs/SAP_DATA_SERVICES/ab33122a997f40d89e340549ff0bced8/574996556d6d1014b3fc9283b0e91070.html

Using PowerShell to Call BODS Web Service

1. Login

$headers1 = @{"SOAPAction" = "function=Logon"}

$soapBody1 = @"

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.businessobjects.com/DataServices/ServerX.xsd">

   <soapenv:Header/>

   <soapenv:Body>

      <ser:LogonRequest>

         <username>administrator</username>

         <password>hidden_hash_value</password>

         <cms_system>localhost</cms_system>

         <cms_authentication>secEnterprise</cms_authentication>

      </ser:LogonRequest>

   </soapenv:Body>

</soapenv:Envelope>

"@


$response1 = Invoke-WebRequest -UseBasicParsing -Method Post -ContentType "text/xml;charset=UTF-8" -Headers $headers1 -Body $soapBody1 http://localhost:8080/DataServices/servlet/webservices?ver=2.1

[xml]$xmlResponse1 = $response.Content

$dsmc_SessionID = $xmlResponse1.Envelope.Body.session.SessionID

$dsmc_SessionID


2. Call Get_BatchJob_Status

$headers2 = @{"SOAPAction" = "jobAdmin=Get_BatchJob_Status"}

$soapBody2 = @"

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.businessobjects.com/DataServices/ServerX.xsd">

   <soapenv:Header>

      <ser:session>

         <SessionID>$dsmc_SessionID</SessionID>

      </ser:session>

   </soapenv:Header>

   <soapenv:Body>

      <ser:batchJobStatusRequest>

         <runID>2</runID>

         <repoName>LOCAL_REPO_DEV1</repoName>

      </ser:batchJobStatusRequest>

   </soapenv:Body>

</soapenv:Envelope>

"@


$response2 = Invoke-WebRequest -UseBasicParsing -Method Post -ContentType "text/xml;charset=UTF-8" -Headers $headers2 -Body $soapBody2 http://localhost:8080/DataServices/servlet/webservices?ver=2.1

[xml]$xmlResponse2 = $response2.Content

$xmlResponse2.Envelope.Body.batchJobStatusResponse


localtypes                                              returnCode status
----------                                              ---------- ------
http://www.businessobjects.com/DataServices/ServerX.xsd 0          error

No comments: