0

How to call spotfire through webservice, and get a pdf report using Java.

The report is already setup in spotfire. i.e people can view the report if they use the spotfire-UI. They can manually export it as pdf USING that UI.

Since one application [NOT user] needs to retrieve those reports in pdf format [e.g by giving a recordID], I want to use a java based webservice call to spotfire ws endpoint/API to get the pdf. How? Examples?

How can I make a programmatic webservice call to spotfire server to get a pdf?

Espresso
  • 5,378
  • 4
  • 35
  • 66
  • It really isn't clear what you are trying to do here. Do you have a Spotfire server set up which contains a report you are outputting to PDF and you want to retrieve that PDF from within a Java program? If you can update your question with more details and the steps you have taken so far it will be easier to help. Even better break the problem down into the specific parts you are having trouble with, research them instead of the whole goal and then ask questions about the specifics parts you are still struggling with. – RyanfaeScotland Jun 03 '15 at 16:23
  • updated question. I had those details details in the initial question, someone said that was not clear, removed,now added the details again :) – Espresso Jun 03 '15 at 18:45

2 Answers2

2

The scope of your question is too big for me to go into specific details just now but in essence it breaks down to three smaller tasks:

  • Give your users the ability to export a report to PDF on demand from a Web Service (i.e. without using any Spotfire client).
  • Call the Web Service from Java.
  • Transfer the created PDF from the Spotfire Server to your client's computer.

Export a Report to PDF on Demand Without Using any Spotfire Client

Since you can already generate the PDF from the Spotfire Client all you have to do is automate this step. To do this you can use the Spotfire Automation Services. Although the name 'Automation' may give the impression this is for creating scheduled tasks it is in fact possible to create event driven tasks as well which I believe you can call through web services. I don't have the specifics but these links look handy:

http://stn.spotfire.com/stn/Tasks/AutomationServices.aspx?pcode=100044

http://stn.spotfire.com/stn/Tutorials/HowToCreateAutomationServicesTask.aspx

http://stn.spotfire.com/stn/Stints/ExportingToPDF.aspx

Once this is done it is also possible to set the Automation Services up to email the PDF to a user (and probably to FTP it as well although I can't guarantee this) which would cover the second section.

Call the Web Service from Java

This should be an easily searchable one with plenty of tutorials but I'll add a link I think looks short and sweet:

http://www.java-samples.com/showtutorial.php?tutorialid=1733

Transfer the created PDF from the Spotfire Server

Once you've got the automated exporting working and can call it from Java you'll be getting a file out to the configured directory and now you need to transfer it via some method from the server to your client's machine. FTP jumps out at me and you can be assured that FTP via Java will already have been handled, libraried and documented. A couple of links for good measure:

What Java FTP client library should I use?

http://www.codejava.net/java-se/networking/ftp/java-ftp-file-download-tutorial-and-example

Thus far I haven't had call to set up this system so I can't guarantee this is the best solution (or that it will definitely work!) but if I was in your shoes this is the approach I would start with.

Community
  • 1
  • 1
RyanfaeScotland
  • 1,216
  • 11
  • 30
0

it may helpful to you. go through below links.

  1. http://spotfired.blogspot.in/2014/02/call-web-service.html

2.http://spotfire.tibco.com/tips/2014/03/03/streaming-xml-and-json-data-from-the-web-directly-into-spotfire-clients-using-script-controls/

Naveen K
  • 65
  • 2
  • 4
  • 11
  • Thanks for the links. The blog does not have info on exporting pdf, calling sf webservice using java. – Espresso Apr 24 '15 at 17:03