Training Downloads With the JavaBeans Activation Framework standard extension, developers who use Java technology can take advantage of standard services to determine the type of an arbitrary piece of data, encapsulate access to it, discover the operations available on it, and to instantiate the appropriate bean to perform said operation s. For example, if a browser obtained a JPEG image, this framework would enable the browser to identify that stream of data as an JPEG image, and from that type, the browser could locate and instantiate an object that could manipulate, or view that image. The JavaBeans Activation Framework is implemented as a standard extension. Sun provides a royalty-free reference implementation of the JAF software, in binary form, that developers can use to develop JAF technology-enabled applications for any platform that supports version 1. JAF 1. The JavaBeans Activation Framework 1.

Author:Nikotaxe Dor
Country:United Arab Emirates
Language:English (Spanish)
Published (Last):12 November 2011
PDF File Size:8.33 Mb
ePub File Size:2.18 Mb
Price:Free* [*Free Regsitration Required]

Please refer to relevant product page for more up-to-date product information and resources. The sample use case which we are going to implement is a Download Statistics Service. This service provides data relating to monthly download statistics of a set of software products. These statistics includes a graph image of the distribution of downloads over a period of one month together with some other data.

The objective of the SOAP with Attachments note is to describe a standard way to associate one or more binary attachments with a SOAP message in their original formats. The service implementation class returns the download statistics data specific to a software product. The name of the product needs to be sent in the form of a SOAP request by the client. The product name is extracted at the service implementation class.

In this scenario, we need to add a binary image file as an attachment to the response SOAP message. We can achieve this by creating a javax. DataHandler object corresponding to the image file and adding it to the attachment map of the outgoing org. Open StatisticsService. Creating the javax.

DataHandler Object In order to create a DataHandler object corresponding to the image file, first we need to create an appropriate javax. DataSource object from the image file. There are several javax. You can choose an appropriate implementation based on the type of data you are going to handle.

You can also write your custom DataSource implementation class based on your need. In this example, we are using the javax. FileDataSource to create the DataSource object corresponding to the image file. DataHandler object. Accessing the Axis2 MessageContext Object of the Outgoing response Message Now we need to access the MessageContext object of the outgoing message in order to add the above created DataHandler object to the attachment map.

We can use the Axis2 MessageContext. Accessing the outgoing MessageContext is not so straight forward. For that we first need to access the incoming MessageContext. In order to do that, we create an OMElement, then add a "href" attribute with the value set to the Content-ID of the attachment.

Care needs to be taken to prefix the Content-ID value with a "cid:" when setting the value of the "href" attribute. Then set the value of the "sampleResourcePath" variable of the service implementation class point to the full path of the "StatisticsServiceResources" directory in your local machine file system.


AttachmentPart setRawContent() Method

Web services users may want to transmit binary attachments of various sorts like images, drawings, XML docs, etc. Such data is often in a particular binary format. Traditionally, two techniques have been used in dealing with opaque data in XML; "By value" Sending binary data by value is achieved by embedding opaque data of course after some form of encoding as an element or attribute content of the XML component of data. The main advantage of this technique is that it gives applications the ability to process and describe data, based only on the XML component of the data. XML supports opaque data as content through the use of either base64 or hexadecimal text encoding.

EN 13698-1 PDF

JavaBeans Activation Framework



JavaMail API - Sending Email With Inline Imagess


Related Articles