wood burning stoves
The moose likes Web Services and the fly likes SOAP with Attachments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "SOAP with Attachments" Watch "SOAP with Attachments" New topic

SOAP with Attachments

Hakan Akkaya

Joined: Nov 21, 2001
Posts: 18
Hi all,
i�m trying to run a WebService in which the Webservice returns a XML File as Response and a gifFile as Attachment. I am trying to run this but i always get this Error:
Unsupported encoding: "null" specified. Using the default encoding.
I�ve found out, that i can set the ContentID like
but i don�t know how to do this.
I am using Apache SOap on Weblogic 6.1 but bea is just used as Server, I do not use the WebService Implementation from BEA.
Can anyone tell me how to do this?
Thank you very much

Hakan Akkaya
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13027
How are you trying to attach the GIF file to the message? Seems to me that it will have to be passed as a byte[] that is base64 encoded.
Hakan Akkaya

Joined: Nov 21, 2001
Posts: 18
Hi Bill,
thank you for your response.
I have made it like that:
The Client :
String[] files = {"D:/Projekte/Parkinfo/parkinfo/source/com/bmw/parkinfo/sp/client/msg.gif","D:/Projekte/Parkinfo/parkinfo/source/com/bmw/parkinfo/sp/client/Whathappens.txt"};
String attachments = "";
for (int i = 0; i < files.length; i++) {
ByteArrayDataSource ds =
new ByteArrayDataSource(new File(files[i]),"image/gif");
DataHandler dh = new DataHandler(ds);
MimeBodyPart bp = new MimeBodyPart();
"myfile" + (i));
DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
InputSource inSo = new InputSource(fr);
Document doc = xdb.parse(inSo);
if (doc == null) {
throw new SOAPException(Constants.FAULT_CODE_CLIENT, "parsing error");
Envelope msgEnv = Envelope.unmarshall(doc.getDocumentElement());
// send the message
msg.send(new URL(url), "", msgEnv);
I thought that the Webservice should do the same .I wanted the files to be attached to the so cales ResponseContext but it won�t work.
Can you give me an Example of how to to that with base64 encoding?
Thank you very much
David Dossot

Joined: May 28, 2002
Posts: 2
Hi Hakan,
Have you solved your SOAP problem? I am currently hitting the same kind of trouble with Sun's JAXM on WebLogic 7.0
It is spitting an unsupported "utf-8" exception, and I don't have the heck of a clue where it comes from!
It is sorta covered in the JavaRanch Style Guide.
subject: SOAP with Attachments
It's not a secret anymore!