On this http://axis.apache.org/axis2/java/core/docs/mtom-guide.html#MTOM_Backward_Compatibility_with_SwA link, the "content-id" is specified in angular brackets.
--MIMEBoundary4A7AE55984E7438034
content-type: application/octet-stream
content-transfer-encoding: binary
content-id: <[email protected]>
In XOP element in SOAP Part, it is referred as -
< xop:Include href="cid:[email protected]"
xmlns:xop="http://www.w3.org/2004/08/xop/include" >
(No angular brackets here )
I don't see anywhere that the angular brackets are mandetory.
I am using SAAJ APIs and it seems they don't attach any brackets to the content id provided.
Can anyone put some more focus on this ?
This is specified in RFC 2392:
A "cid" URL is converted to the corresponding Content-ID message header by removing the "cid:" prefix, converting the % encoded character to their equivalent US-ASCII characters, and enclosing the remaining parts with an angle bracket pair, "<" and ">".
Some SwA/MTOM implementations don't conform to that spec and don't add the brackets. This is generally not a problem because most SwA/MTOM implementations accept such non conforming messages.
Regarding SAAJ, the Javadoc of the AttachmentPart#setContentId(String)
method specifies this:
Sets the MIME header whose name is "Content-Id" with the given value.
This means that you should pass it a value that includes the brackets.