Sunday, February 19, 2012

Exporting to PDF in Java with web interface issue

Hi, thanks for taking the time to take a look at this.

As you can read from the title, I'm trying to export a report to pdf from a thick java client. My connection string is:
"http://10.0.1.36/ReportServer/?/Invoice1/Invoice&assetNbr=14
&invoiceId=061000002&rs:Command=Render:&rs:Format=PDF&rc:Toolbar=false"
(I just added the toolbar=false part, and it didn't fix the problem)

After getting the datastream I just throw it into a file and it works fine... Until I add an image to my report. I don't get any errors in my program, but when I try to open up the pdf itself I get the error: "There was an error opening this document. The file is damaged and could not be repaired."

What confuses me is that if I enter the connection string in ie it comes up and asks me what I should do with the pdf and that one has the image in it with not problems.

To summarize if I've been unclear:
Export via ie no image: good
Export via ie with image: good
Export via java no image: good
Export via java with image: error

Does anyone have an idea why this would occur? I have an Execution Account set up in Reporting Services Configuration Manager and I have IIS anonymous access set up to use my local administrator account so I don't think accessing the image is an issue. But I'm definitely no server/admin expert so if there are any such issues could be causing this don't assume I've got that set up properly.

Thanks, JeffAre you certain that you are writing the file correctly from your Java app?|||I'm pretty sure I am. The whole setup works and exports correctly when connecting to a report that doesn't have an image embedded in it.

Also, is there any way to access the reports other than the web interface from java? I've only seen implementations of this in C# and vb.net|||

You should be able to use any Java SOAP toolkit (such as JAX).

FWIW, perhaps the report w/the image is larger, and exposing some bug in your Java code? Maybe you should compare the byte count of the IE output to what you are getting w/Java.

|||My face is red, it just was that I was stopping the fileout one byte too early... Thanks a bunch for your help.

If I can ask one more favor of you, I'm not familiar with the components involved in using SOAP so if you could give me a little overview that would give me someplace to start reading about it I'd really appreciate it.|||

I've never used any of SOAP toolkits for Java... so I can't really help you out there. This showed some links which may be of interest to you:

http://search.live.com/results.aspx?q=java+SOAP+toolkit&mkt=en-US&form=QBRE

No comments:

Post a Comment