File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Java » Web Services
Bookmark "SOAP with Attachments" Watch "SOAP with Attachments" New topic
Author

SOAP with Attachments

Hakan Akkaya
Greenhorn

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
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

Joined: Mar 22, 2000
Posts: 12678
    
    5
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


Java Resources at www.wbrogden.com
Hakan Akkaya
Greenhorn

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();
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

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!
Rgds,
David
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SOAP with Attachments
 
Similar Threads
Where to find encoding
Problem invoking weservice of SOAP Document style with literal encoding in Weblogic
No Deserializer found error
Using java.lang.Arraylist object in WSAD WebServices
SAAJ API: recovering the SOAPMessage object from a soap message