File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes sending attachments from server to client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "sending attachments from server to client" Watch "sending attachments from server to client" New topic

sending attachments from server to client

Karthik Mohan

Joined: Sep 29, 2004
Posts: 23
hi everyone,

I am currently designing a web service on Weblogic 8.1 server using weblogic workshop IDE. My requirement is to attach the backend result (results obtaind from the database) as an attachment to the SOAP message and return it back to the client.

I saw a few examples of the javax.activation.DataHandler class and also read about using SAAJ for attaching objects to a SOAP message.

Can somebody point me to concrete examples of SOAP attachments for both server and the client. I hav tried to use the examples that I read, but they did not work for me. I maybe doing something wrong, so thats why i need examples that would work to test and then adopt them in my implementation.

I could not find examples of SAAJ implementation on the server side. I would like to modify the SOAP message inside the webservice function itself rather then doing it within the handlers. The problem with using handlers is that I don't know how to access the data returned by the backend and attach it to the SOAP body. i saw few examples of doing the same using AXIS, but i am using weblogic workshop, and there are no api's to access the message context from the webservice function itself.

also, if anyone has experience designing web services using weblogic workshop, I have a few qns.

any pointers to the above topics would be really helpful.


Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
there is an axis web service implementation that accepts an image transferred from client as soap request and this web service saves that image as file on the server and Sun's JAF (Java Activation Framework) is used for this purpose. Let me know if this helps and give me your personal id so that I can send code related to this and some soft copies of books that I have on weblogic web services.

RR Kumaran
SCJP 1.4
Karthik Mohan

Joined: Sep 29, 2004
Posts: 23
Mostly all the examples, that i found were using Axis SOAP engine, but i could not really find examples for Weblogic.

Nritya, it would be really helpful if you could send the examples that you have and the also the e-books. Thanks a lot. My email is k_mohanas AT yahoo DOT com. If you can send me all the code that you have realted to web services that would be great too. As i would be requiring them in the future as we start building our application.

I tried using the javax.activation.DataHandler function to return the attachment object but while generating code in weblogic to be used for the client side, it gave me some error. it was late in the night i might have been under the influence of sleep :-), I will check it now and reply back if it works.
[ December 17, 2004: Message edited by: Karthik M ]
I agree. Here's the link:
subject: sending attachments from server to client
It's not a secret anymore!