简体   繁体   中英

In SOAP MTOM, what is the syntax to specify “content-id” in Attachment Part section?

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: <1.A91D6D2E3D7AC4D580@apache.org>

In XOP element in SOAP Part, it is referred as -
< xop:Include href="cid:1.A91D6D2E3D7AC4D580@apache.org" 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM