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
Using PowerShell Invoke-WebRequest 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
---------- ---------- ------
http://www.businessobjects.com/DataServices/ServerX.xsd 0 error
Using PowerShell New-WebServiceProxy to Call BODS Web Service
# Stores the session_id for next call
Analysis
- New-Object "dsmc_namespace.LogonRequest" - wsdl contains "<xsd:element name="LogonRequest">" with complexType, and 4 string parameters of username , password , cms_system , cms_authentication
- Logon() - wsdl indicated that the pass-in parameter is call "LogonRequest" directly under the root. It does not belongs to any class (PowerShell), or wsdl:binding (wsdl)
- PowerShell needs to call New-Object -TypeName $dsmc_namespace`.<wsdl:binding> to switch between 5 different binding of Batch_Job_Admin, Repo_Operations, Batch_Jobs, Connection_Operations, Realtime_Service_Admin (default)
No comments:
Post a Comment
Welcome any comment. Be polite and respect everyone