关于这个http://axis.apache.org/axis2/java/core/docs/mtom-guide.html#MTOM_Backward_Compatibility_with_SwA链接中,“content-id”在尖括号中指定。
--MIMEBoundary4A7AE55984E7438034
内容类型:应用程序/八位字节流
内容传输编码:二进制
内容 ID:<1.A91D6D2E3D7AC4D580@apache.org>
在 SOAP 部分的 XOP 元素中,它被称为 -
< xop:包括 href="cid:1.A91D6D2E3D7AC4D580@apache.org"
xmlns:xop="http://www.w3.org/2004/08/xop/include">
(这里没有尖括号)
我没有看到任何地方尖括号是强制性的。
我正在使用 SAAJ API,它们似乎没有在提供的内容 ID 上附加任何括号。
有人能更加关注这一点吗?
最佳答案
这是在 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 ">".
一些 SwA/MTOM 实现不符合该规范,并且不添加括号。这通常不是问题,因为大多数 SwA/MTOM 实现都接受此类不合格消息。
关于 SAAJ,AttachmentPart#setContentId(String)
方法的 Javadoc 指定了这一点:
Sets the MIME header whose name is "Content-Id" with the given value.
这意味着您应该向其传递一个包含括号的值。
关于java - 在 SOAP MTOM 中,在附件部分部分指定 "content-id"的语法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31005256/