[ https://issues.apache.org/jira/browse/AXIS2-5067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13047031#comment-13047031 ]
Ivan commented on AXIS2-5067: ----------------------------- A bit explanation for the patch a. From the JavaDoc of saveChanges method in the SOAPMessage class, the codes in the patch will create the content-type header information for the SOAPMessage ---> Updates this SOAPMessage object with all the changes that have been made to it. This method is called automatically when writeTo(OutputStream) is called. However, if changes are made to a message that was received or to one that has already been sent, the method saveChanges needs to be called explicitly in order to save the changes. The method saveChanges also generates any changes that can be read back (for example, a MessageId in profiles that support a message id). All MIME headers in a message that is created for sending purposes are guaranteed to have valid values only after saveChanges has been called. In addition, this method marks the point at which the data from all constituent AttachmentPart objects are pulled into the message. <--- b. In the writeTo method, the codes in the patch will try to take the information from contentType and fill them into the OutputFormat. With these changes, if a message with content-type is received, the same contents will be gotten if call writeTo method. Also, if we create a message from scratch, multiple call of writeTo method will get the same message contents. Thanks. > content-type header is not generated with SAAJ API > -------------------------------------------------- > > Key: AXIS2-5067 > URL: https://issues.apache.org/jira/browse/AXIS2-5067 > Project: Axis2 > Issue Type: Bug > Components: saaj > Affects Versions: 1.7.0 > Reporter: Ivan > Attachments: AXIS2-5067.patch > > > In the scenario below : > SOAPMessage msg = MessageFactory.newInstance().createMessage(); > SOAPPart sp = msg.getSOAPPart(); > SOAPEnvelope envelope = sp.getEnvelope(); > SOAPBody bdy = envelope.getBody(); > SOAPBodyElement sbe = bdy.addBodyElement(envelope.createName("Body1", > "ns1", "http://www.helloworld.org")); > sbe.addChildElement(envelope.createName("c1", "ns1", > "http://www.helloworld.org")).addTextNode("HelloWorld"); > > URL url = new > File("D:\\opensource\\axis2\\axis2\\axis2-1.5\\modules\\saaj\\pom.xml").toURI().toURL(); > AttachmentPart attachmentPart = msg.createAttachmentPart(new > DataHandler(url)); > attachmentPart.setContentType("text/xml"); > msg.addAttachmentPart(attachmentPart); > msg.saveChanges(); > If we use SOAPMessage.writeTo method to write to the message to an servlet > outputstream, those boundary, content-id values are generated on the fly. And > for the client applications, there is no way to get the corresponding > content-type header. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org For additional commands, e-mail: java-dev-h...@axis.apache.org