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
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
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:
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.
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.