Hi,

I've been having some issues with Axiom's SOAP with Attachments' support. Here's what I try to do, more or less:

  SOAPMessage message = ... // an Axiom SOAP message
Attachments attachments = ... // an Axiom attachment instance with some attachments in it
  OMOutputFormat format = new OMOutputFormat();
  format.setCharSetEncoding(message.getCharsetEncoding());
  format.setSOAP11(true);
  format.setDoingSWA(true);
  StringWriter writer = new StringWriter();
  axiomMessage.getSOAPEnvelope().serialize(writer, format);
MIMEOutputUtils.writeSOAPWithAttachmentsMessage(writer, outputStream, attachments, format);

Ignoring for a moment the hoops I have to jump through (writing the message to a StringWriter ?!?), running this code will give me the following stacktrace:

java.io.IOException: Invalid content type "text/xml; charset=UTF-8" for XmlDCH at com .sun .xml .internal .messaging .saaj.soap.XmlDataContentHandler.writeTo(XmlDataContentHandler.java:106) at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java: 868)
        at javax.activation.DataHandler.writeTo(DataHandler.java:301)
        at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:452)
at org .apache .axiom.om.impl.MIMEOutputUtils.writeBodyPart(MIMEOutputUtils.java:245) at org .apache .axiom .om .impl .MIMEOutputUtils.writeSOAPWithAttachmentsMessage(MIMEOutputUtils.java: 283)
        ... 33 more

This is on Mac OS X, JDK 1.6.

After some decompiling of the JDK, it seems to be related to the built in DataHandler for XML not being able to handle the charset part of the content-type; it can only handle the exact strings "text/xml" or "application/xml". Wrong, I know, but since I don't have commit-access to the JDK I am more-or-less stuck with it as is.

Am I doing something wrong, or should I file a JIRA for this?

Thanks,

Arjen
---
Arjen Poutsma
Senior Software Engineer, SpringSource
Spring Web Services Lead
E: [EMAIL PROTECTED]
W: www.springsource.com
B: blog.springsource.com/arjen





Reply via email to