This content has been marked as final.
Show 3 replies
-
1. Re: SoapMessage on JBoss 4.0.3
anil.saldhana Nov 7, 2005 8:49 AM (in response to fabbricadigitale)Can you post the code that uses the SAAJ API to construct the soap message with attachments? Just the relevant portion of the code that does this will suffice. You can use the "code" button in the wiki to post the code.
This seems to be a bug in the saaj infrastucture driven by axis in JBoss 4.0.3 -
2. Re: SoapMessage on JBoss 4.0.3
fabbricadigitale Nov 7, 2005 9:26 AM (in response to fabbricadigitale)This is the portion of code.
I need to attach a mime multipart attachmentSOAPMessage message = messageFactory.createMessage(); SOAPPart soapPart = message.getSOAPPart(); SOAPEnvelope envelope = soapPart.getEnvelope(); SOAPBody soapBody = envelope.getBody(); SOAPElement bodyElement = soapBody.addBodyElement(BODY_ELEM_NAME); //...not relevant code bodyElement.addChildElement(CHILD_NAME).addTextNode("textNode"); bodyElement.addChildElement(OTHER_CHILD_NAME).addTextNode("textNode"); // ... // Create MimeMultipart to attach to the message String text = "Example ..."; MimeMultipart multipart = new MimeMultipart(); //add the text to the multipart MimeBodyPart textPart = new MimeBodyPart(); textPart.setDataHandler(new DataHandler(new ByteArrayDataSource( "Text data", text.getBytes(), "text/plain"))); textPart.setContentID("text1.txt"); textPart.setHeader("Content-Type", "text/plain"); textPart.setDisposition(MimeBodyPart.ATTACHMENT); textPart.setHeader("Content-Transfer-Encoding", "binary"); textPart.setFileName("text1.txt"); multipart.addBodyPart(textPart); // add another content byte[] imgContent= getImageContent(myImage);//a custom method to retrieve some contents MimeBodyPart imgPart = new MimeBodyPart(); imgPart.setDataHandler(new DataHandler(new ByteArrayDataSource( "image data", imgContent, "image/jpg"))); smilPart.setContentID("image.img"); smilPart.setHeader("Content-Type", "image/jpeg"); smilPart.setDisposition(MimeBodyPart.ATTACHMENT); smilPart.setHeader("Content-Transfer-Encoding", "base64"); smilPart.setFileName("file1.jpg"); multipart.addBodyPart(imgPart, 0); multipart.setSubType("related"); AttachmentPart multipartAtt = message.createAttachmentPart( multipart, multipart.getContentType()); multipartAtt.setContentId("multipart-content-id"); message.addAttachmentPart(multipartAtt); message.saveChanges(); printMessage(message); SOAPMessage reply = connection.call(message, address);
I've deleted some portions of code not relevant -
3. Re: SoapMessage on JBoss 4.0.3
thomas.diesler Nov 11, 2005 5:46 AM (in response to fabbricadigitale)This has been assigned to
http://jira.jboss.org/jira/browse/JBWS-488