Consuming BODS RESTful Web Services

Hi all. I’m trying to contact BODS’s REST wservices, without success.
I set up the Access Server on port 4000, and tried with a simple “Ping” call:

http://myhost:4000/RestWebService/Ping

but nothing happen.
Running a “netstat -ano” on BODS server I can see the connection, but nothing comes back.
Needless to say that I also tried a Logon call, passing the following JSON flow with same result

{
“logonRequest”: {
“cms_authentication”:“secEnterprise”,
“username”:“Administrator”,
“password”:“**********”,
“cms_system”:“cms system:6400”
}
}

Thank you for your help
Claudio

I’ve created a short VBscript working for me.
If you use a Windows box, you may try it. If not, you may get ain idea how to use DS websevices correctly.

'-----------------------------------------------------------------------------------------------------------
'Demo VBscript for BOBJ forum, post URL: https://bobj-board.org/t/consuming-bods-restful-web-services/259622
'Demonstrates how to use SAP DataServices built-in webservices for Ping operation
'Key points 1. URL, 2. SOAP request, 3. SOAP action
'Usage: 1. Adjust wsHost & wsPort variables tp your environment
'	2. save this script to your C:\Temp directory as PingDS.vbs	
'	3. From command line run C:\Windows\SysWoW64\cscript.exe /nologo C:\Temp\PingDS.vbs
'Author: Surika, 2025.04.23
'-----------------------------------------------------------------------------------------------------------

Dim wsHost, wsPort, wsURL
'Change wsHost, wsPort to your environment
wsHost = "MyHost" : wsPort = "MyPort"	'default port:8080
'Key point 1.
wsURL = "http://" & wsHost & ":" & wsPort & "/DataServices/servlet/webservices"	'you may include the version '?ver=2.1'"

'Settings foar SOAP
Dim soapReq,soapAction
'Key point 2.
soapReq = vbTab & "<soapReq:Envelope xmlns:soapReq=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:ser=""http://www.businessobjects.com/DataServices/ServerX.xsd"">"  & vbCrLf _
 & vbTab & "<soapReq:Header>"  & vbCrLf _
 & vbTab & "</soapReq:Header>"  & vbCrLf _
 & vbTab & "<soapReq:Body>"  & vbCrLf _
 & vbTab & vbTab & "<ser:Ping/>"  & vbCrLf _
 & vbTab & "</soapReq:Body>" & vbCrLf _
 & vbTab & "</soapReq:Envelope>"

'Key point 3.
soapAction = "function=Ping"

On Error Resume Next	'not exit script on error immediately

Dim XMLHTTPServer
Set XMLHTTPServer = CreateObject("MSXML2.ServerXMLHTTP.6.0")
If Err.Number <> 0 Then
	WScript.Echo "Error crating object 'MSXML2.ServerXMLHTTP.6.0':" & "Err.Number:" & Err.Number & " , Err.Description: " & Err.Description & vbCrLf & "Quit script."
	WScript.Quit
End If
XMLHTTPServer.SetTimeouts 5000, 5000, 5000, 20000
WScript.Echo "Opening URL '" & wsURL & "' for POST"
XMLHTTPServer.Open "POST", wsURL, True
If Err.Number <> 0 Then
	WScript.Echo "Error Error opening wsURL:" & "Err.Number:" & Err.Number & " , Err.Description: " & Err.Description & vbCrLf & "Quit script."
	WScript.Quit
End If

XMLHTTPServer.SetRequestHeader "Content-Type", "text/xml"
WScript.Echo "Set soapAction to: '" & soapAction & "'"
XMLHTTPServer.SetRequestHeader "soapAction", soapAction
WScript.Echo "Sending SOAP request:"  & vbCrLf & soapReq
XMLHTTPServer.Send soapReq
If Err.Number <> 0 Then
	WScript.Echo "Error sending :SOAP request:" & "Err.Number:" & Err.Number & " , Err.Description: " & Err.Description & vbCrLf & "Quit script."
	WScript.Quit
End If

XMLHTTPServer.waitForResponse 10
If Err.Number <> 0 Then
	WScript.Echo "Error receiving response:" & "Err.Number:" & Err.Number & " , Err.Description: " & Err.Description & vbCrLf & "Quit script."
	WScript.Quit
End If

WScript.Echo "HTTP readystate:" & XMLHTTPServer.readystate
If XMLHTTPServer.readystate = 4 Then
	WScript.Echo "Response status:" & XMLHTTPServer.status
	WScript.Echo  "Response text:" & XMLHTTPServer.responsetext
Else
	WScript.Echo "Request not completed."
End If

Set XMLHTTPServer = Nothing
WScript.Quit

So kind of you, Surika.
It worked for me. I’m now moving on to use more complex (and useful) workflows.
Thank you so much for your prompt reply.

Karoly hi again,
I tried all afternoon/evening long to make a step forward, but with no success. Surely this is because of my poor knowledge on SOAP syntax.
Could you help me a bit more with a logon example?
My goal is retrieving the logon session and launch a batch job.
My initial idea was to do this through a REST call. But of course, any method would be good if it works.
Thank you again
Claudio

Hello,
SOAP and REST syntax differs a bit. You have to encapsulate the REST request into a SOAP emvelope.
In DS 4.3 Integrator Guide you can’t find any information on syntax.
In 4.2 you may find some useful examples.

I finally had it working. I dare say that neither 4.2 manuals provided more examples, and did it all mainly with your help, and the light sample given with the Validate Session call.
However, I succeded with having both functions working:

Validate Session
Logon
Here are the XML messages, that others may use with the code you provided:

Validate Session<<

soapAction = “function=Validate_SessionID”

soapReq = vbTab & “<soapenv:Envelope xmlns:soapenv=”“http://schemas.xmlsoap.org/soap/envelope/”" xmlns:ser=““SAP Software Solutions | Business Applications and Technology””>" & vbCrLf _
& vbTab & “soapenv:Header” & vbCrLf _
& vbTab & “ser:session” & vbCrLf _
& vbTab & vbTab & “69B89E79-34E3-BBEF-18A4-979A8C73A0E5A84A6DA144C9B0DF5ED6D559E991E69D” & vbCrLf _
& vbTab & “</ser:session>” & vbCrLf _
& vbTab & “</soapenv:Header>” & vbCrLf _
& vbTab & “soapenv:Body” & vbCrLf _
& vbTab & vbTab & “ser:ValidateSessionIDRequest/” & vbCrLf _
& vbTab & “</soapenv:Body>” & vbCrLf _
& vbTab & “</soapenv:Envelope>”

Logon<<

soapAction = “function=Logon”

soapReq = vbTab & “<soapenv:Envelope xmlns:soapenv=”“http://schemas.xmlsoap.org/soap/envelope/”" xmlns:ser=““SAP Software Solutions | Business Applications and Technology””>" & vbCrLf _
& vbTab & “soapenv:Header” & vbCrLf _
& vbTab & vbTab & “ser:Logon/” & vbCrLf _
& vbTab & “</soapenv:Header>” & vbCrLf _
& vbTab & “soapenv:Body” & vbCrLf _
& vbTab & vbTab & “ser:LogonRequest” & vbCrLf _
& vbTab & vbTab & “Administrator” & vbCrLf _
& vbTab & vbTab & “Admin2024!” & vbCrLf _
& vbTab & vbTab & “<cms_authentication>secEnterprise</cms_authentication>” & vbCrLf _
& vbTab & vbTab & “<cms_system>tdwhbo43</cms_system>” & vbCrLf _
& vbTab & vbTab & “</ser:LogonRequest>” & vbCrLf _
& vbTab & “</soapenv:Body>” & vbCrLf _
& vbTab & “</soapenv:Envelope>”

Thank you so much for your help
Claudio

– Run a job from a given Repo:

soapReq = vbTab & “<soapenv:Envelope xmlns:soapenv=”“http://schemas.xmlsoap.org/soap/envelope/”" xmlns:ser=““SAP Software Solutions | Business Applications and Technology””>" & vbCrLf _
& vbTab & “soapenv:Header” & vbCrLf _
& vbTab & vbTab & “ser:session” & vbCrLf _
& vbTab & vbTab & “A4F509D1-15BB-6132-D00D-DDD86B1FE3A6F79FF49C23CCBBB7A147049C4AF2DE46” & vbCrLf _
& vbTab & vbTab & “</ser:session>” & vbCrLf _
& vbTab & “</soapenv:Header>” & vbCrLf _
& vbTab & “soapenv:Body” & vbCrLf _
& vbTab & vbTab & “ser:Run_Batch_Job” & vbCrLf _
& vbTab & vbTab & “YOUR BATCH JOB” & vbCrLf _
& vbTab & vbTab & “YOUR REPO” & vbCrLf _
& vbTab & vbTab & “</ser:Run_Batch_Job>” & vbCrLf _
& vbTab & “</soapenv:Body>” & vbCrLf _
& vbTab & “</soapenv:Envelope>”

soapAction = “jobAdmin=Run_Batch_Job”

When learning the SOAP requests I would highly recommend installing SoapUI. It’s free and it sets up tests for all the requests in the xsd. Just point it at the xsd file (if memory serves, there’s a URL on the management console you can copy and paste. It lets you play around with all the requests and responses with little to no code)

I tried that trail, but did not work for me as it did not recognize BODS’s WSDL (I tried both with WSDL and WADL, as my first attempt was through REST calls, and diverted to SOAP after Karoly’s enlighting example).
Surely my failure was due to my lack of experience. However, should you have a working example, I would find really useful digging into it.

Here are the instructions I followed.

In SAP BODS Management console go into Administrator > Click on Web Services on left hand nav menu > Click on View WSDL at the bottom > copy the URL. It will be something like http://xxxxxxxxx/DataServices/servlet/webservices?ver=2.1&wsdlxml

In SoapUI click File > New SOAP Project > give the project a name and paste in the URL.

This should generate everything for you.

Just to clarify, in SAP BODS, you can consume REST API data in a datastore, and also publish RESTful webservices for accessing data via real-time jobs. You can’t interact with the bods job server using REST though. Only SOAP.