users@saaj.java.net

[SAAJ-USR] SOAPMessage.writeTo(ByteArrayOutputStream) works fine standalone, but fails from servlet

From: Karr, David <David.Karr_at_wamu.net>
Date: Fri, 19 Dec 2003 10:08:20 -0800

I have a method which takes a SOAPMessage (actually ends up being
"com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl"). The method
creates a ByteArrayOutputStream and calls
"SOAPMessage.writeTo(OutputStream)" to write the contents of the
SOAPMessage as a string to the stream (I assume that's the intent of
that).

I wrote several Junit tests which end up calling this method, and they
work perfectly fine.

I now have a servlet which ends up calling the same method, and a Cactus
test, with implicitly identical data to the Junit test, and when it gets
to the "writeTo()" call in this method, I get the stack trace which
follows this. I don't understand what is happening here.

java.io.IOException: "text/xml" DataContentHandler requires String
object, was given object of type class javax.xml.transform.dom.DOMSource
        at com.sun.mail.handlers.text_plain.writeTo(text_plain.java:97)
        at
javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:849)
        at javax.activation.DataHandler.writeTo(DataHandler.java:305)
        at
javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1089)
        at
javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:635)
        at
javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:233)
        at
com.sun.xml.messaging.saaj.soap.MessageImpl.saveChanges(MessageImpl.java
:563)
        at
com.sun.xml.messaging.saaj.soap.MessageImpl.writeTo(MessageImpl.java:591
)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_saaj.dev.java.net
For additional commands, e-mail: users-help_at_saaj.dev.java.net