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 JAX-RPC and Attachments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-RPC and Attachments" Watch "JAX-RPC and Attachments" New topic

JAX-RPC and Attachments

Surasak Leenapongpanit
Ranch Hand

Joined: May 10, 2002
Posts: 341
Can somebody tell me whether it is possible to use JAX-RPC in a way the request contains attachments and the response also contains attachments? What would this look like from a service definition perspective?
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

SOAP with Attachments API for Java (SAAJ) is used mainly for the SOAP
messaging that goes on behind the scenes in JAX-RPC and JAXR implementations.
Secondarily, it is an API that developers can use when they choose to write
SOAP messaging applications directly rather than using JAX-RPC. The SAAJ
API allows you to do XML messaging from the Java platform: By simply making
method calls using the SAAJ API, you can create, send, and consume XML
messages over the Internet. This chapter will help you learn how to use the SAAJ

Richard Monson-Haefel
Ranch Hand

Joined: Oct 31, 2003
Posts: 92
Here is a quote from my book ... take that Pradeep Bhat! Just kidding.
----------- J2EE Web Services, AW 2004 ------------
Sending and receiving SOAP Messages with Attachments (SwA) using JAX-RPC is deceptively easy. I say "deceptively" because, like SAAJ, JAX-RPC depends on the Java Activation Framework (JAF) to handle the marshalling of attachments to and from SOAP messages, so sending and receiving attachments depends in large part on the types of DataContentHandler classes that your J2EE application server provides. This appendix will explain how JAX-RPC supports the SwA standard using JAF.
Essentially there are two ways to support attachments in JAF: You can use javax.activation.DataContentHandler classes or javax.activation.DataSource classes. Each of these interfaces has its strengths and weaknesses. Generally Data ContentHandler types are more convenient, because their operation is hidden, while the DataSource types are less user-friendly but easier to get working. The following provides a quick overview of the DataContentHandler and DataSource types and their strengths and weaknesses. For in-depth coverage of JAF, though, you should read Section F.1 of Appendix F: SAAJ Attachments.
There is a lot more to it, but this is how the appendix on the subject starts. Its an appendix in my book because SwA is not yet sanctioned by the WS-I. there are some serioius interop problems that need to be worked out. That said, The WS-I Basic Profile 1.1, which is now in developement, does address the use of SwA.

-- <br />Richard Monson-Haefel<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: JAX-RPC and Attachments
It's not a secret anymore!