By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,454 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Add a attachment with a jpeg file to a soap messages

P: n/a
Hi everybody!!
First of all, sorry about my english. I promise to improve it. I have
a big problem when I try to add an attachment which contains a image
in it. I have to solve it as soon as possible so i would really
appreciate any help.
The mistake thrown is the following:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME
type image/gif at javax.activation.ObjectDataContentHandler.writeTo( DataHandler.java:851)
at javax.activation.DataHandler.writeTo(DataHandler.j ava:305)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyP art.java:1089)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyP art.java:635)
at javax.mail.internet.MimeMultipart.writeTo(MimeMult ipart.java:233)
at com.sun.xml.messaging.saaj.soap.MessageImpl.saveCh anges(MessageImpl.java:563)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConn ection.post(HttpSOAPConnection.java:223)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConn ection$PriviledgedPost.run(HttpSOAPConnection.java :151)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConn ection.call(HttpSOAPConnection.java:121)
at com.vod.mm7inbound.GenericListenerThread.run(Gener icListenerThread.java:221)
at java.lang.Thread.run(Thread.java:536)
Feb 20, 2004 12:43:54 PM com.sun.xml.messaging.saaj.soap.MessageImpl
saveChanges
SEVERE: SAAJ0540: Error during saving a multipart message
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Error during saving a
multipart message
The code is this:
************************************************** *********************************************

File fd = new File("/home/tibco/products/adapters/development/esther/mm7inbound/scripts/1.gif");
FileInputStream miFicheroSt = new FileInputStream(fd);
int numb = miFicheroSt.available();
byte[] imagen = new byte[numb];
for (int i= 0; i<numb;i++)
{
imagen[i]=(byte)miFicheroSt.read();
}
AttachmentPart ap = message.createAttachmentPart();
//DataHandler pdfDH = new DataHandler(miFicheroSt ,"text/plain");
//ap.setDataHandler(pdfDH);
ap.setContentType("image/gif");
ap.setContent(new ByteArrayInputStream(imagen) ,"image/gif");
message.addAttachmentPart(ap);.

Thanks in advance.
Bye.
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: 1
Hi Antonio.

I too am having the same problem. Could you please let me know if you have any solution for the soap atachment.
please email me at vamshi.maram@gmail.com.

I really appreciate your help if you can send me the solution.


Thanks
Vamshi
Nov 8 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.