Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SOAP with Attachments

 
Hakan Akkaya
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
setContentID("image/gif");
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
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Bill
 
Hakan Akkaya
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
bp.setDataHandler(dh);
bp.setFileName(files[i]);
bp.setHeader(org.apache.soap.Constants.HEADER_CONTENT_LOCATION,
"myfile" + (i));
msg.addBodyPart(bp);
}
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
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
Rgds,
David
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic