You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Shimon Crown <sh...@equipnet.co.il> on 2002/09/18 15:43:05 UTC

Sending an object as an attachment

As an experiment and proof of concept I would like to send a Java object or
an undefined BLOB as an attachment. I ran the attachment sample and
everything seems fine. Looking in EchoAttachment.java I see the following
line

    //Create the data for the attached file.
    DataHandler dhSource = new DataHandler( new FileDataSource( filename ));

My problem is how do I create a DataSource from a memory block. I did try
something like this

    //Create the data for the attached file.
    DataHandler dhSource = new DataHandler(myobject,
"application/octet-stream"); // my object could be anything

but I got a marshalling exception at invoke complaining that it doesn't know
how to handle "application/octet-stream" (even though I copied this as the
mime type from the FileDataSource above).

I realise this is probably an activation framework problem but there doesn't
seem to be a good group for this topic.

Okay over to you,

Shimon Crown