Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to open attachments

 
Michael Hul
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im not sure exactly where this question belongs so I'll just post it here since it's related to the webservices I'm working on.

I have a service that when invoked returns the response with a pdf as an attachment. This is all initiated from a jsp page. A user clicks a button which then submits the form and then i have a scriptlet call a java class where the webservice is consumed. This returns the response and displays it in the jsp. Now, i also have a second button titled 'Display PDF' that when clicked I need to have display the pdf attachment in another window. How the heck do I go about that??
 
Nishant Modak
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assumption: The service-reply has the attachment as 'SOAP attachment'.

1. Without the need for the Display PDF button.
---> The service response that you get can be handled with *coding* Handlers in the client side, where you can process the returned pdf attachment and then display it directly in the browser.

2. With the Display PDF button.
---> You still code the client handler for handling the service-reply with attachment then store it locally. And when the Display pdf is clicked in the same session. Display the pdf (open the pdf) in the browser.

I hope this helps. Let the forum know, how you achieved this.
 
Michael Hul
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I should have posted earlier, but I did something like your 2nd suggestion. Since I invoked the webservice using the following I get the attachment (if it exists) using the following Then I convert the attachment to a byte array and store it in a static class variable in a separate class so that when the 'Display PDF' button is clicked, it loads a servlet that can access the attachment using a call similar to the following then I display it using That seems to work fine. Thanks for the reply
[ November 11, 2008: Message edited by: Michael Hul ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic