Jump to content
We've recently updated our Privacy Statement, available here ×

Running a report from VBScript


graham.smith

Recommended Posts

I've been playing around with some vbscript to try and figure out how to format and send a valid ReportExecutionRequest to run a report, and then retrieve the output as a PDF file I can save somewhere - but haven't got very far (knowing very little about calling and using webservices - to me, SOAP is something you wash your hands with, and REST is what you need after the grandchildren have visited - it's all foreign to me).

So this is as far as I have got, using various bits and pieces from scripts I've found online.  The result is that the http.send just times out.

' VBScript to setup and call JasperServer RESTful APIs to execute a report. ' create xmlHttp objectset http = createObject("msxml2.serverxmlhttp.6.0") ' create XML Execution RequeststrExecReq =     "<reportExecutionRequest>" &_                "<reportUnitUri>/TMS_Reports/Emergency_Evacuation_Checklist</reportUnitUri>" &_                "<async>true</async>" &_                "<freshData>false</freshData>" &_                "<saveDataSnapshot>false</saveDataSnapshot>" &_                "<outputFormat>pdf</outputFormat>" &_                "<interactive>false</interactive>" &_                "<ignorePagination>false</ignorePagination>" &_                "<parameters>" &_                    "<reportParameter name=""EvacuationSite"">" &_                            "<value>BI</value>" &_                       "</reportParameter>" &_                "</parameters>" &_        "</reportExecutionRequest>"  ' Run the report synchronously (i.e. waits for it to finish)http.open "POST", "http://localhost:8080/jasperserver/rest_v2/reportExecutions", falsehttp.SetRequestHeader "Content-Type", "text/xml"http.setRequestHeader "Content-Length", Len(strExecReq)http.send strExecReq ' http response (should contain request ID?)WScript.Echo http.responseText

Any advice would be gratefully received :)

Thanks, Graham

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Looks as though the timeouts are a random anomaly.  Other times it runs but with no returned reponse.  However, the times it runs, I can see a 401 status code returned.  This is something to do with authentication I am guessing - so presumably I need to enter some credentials somehow - maybe in the reportExecutionRequest XML?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...