[
https://issues.apache.org/jira/browse/CXF-1900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12649696#action_12649696
]
mmayer edited comment on CXF-1900 at 11/21/08 8:26 AM:
-------------------------------------------------------------
I have a similar issue: if I invoke a simple MTOM-enabled Axis2 (v1.4.1)
service from a CXF (v2.1.3) client, the Axis2 service fails with the following
exception:
[ERROR] Referenced Attachment not found in the MIME Message. ContentID:[EMAIL
PROTECTED]://cxf.apache.org/
Caused by: org.apache.axiom.om.OMException: Referenced Attachment not found in
the MIME Message. ContentID:[EMAIL PROTECTED]://cxf.apache.org/
Looking at the message from the CXF client I realized that both, the cid-Url
and the Content-Id message header, were URL-encoded (although RFC 2111 states
the cid URL should be, the Content-Id message header not).
I fixed the problem by URL-decoding the Id of the Attachment in
org.apache.cxf.attachment.AttachmentSerializer:
private void writeHeaders(String contentType, String attachmentId, Writer
writer) throws IOException {
writer.write("\r\n");
writer.write("Content-Type: ");
writer.write(contentType);
writer.write("\r\n");
writer.write("Content-Transfer-Encoding: binary\r\n");
writer.write("Content-ID: <");
writer.write(URLDecoder.decode(attachmentId, "UTF-8"));
writer.write(">\r\n\r\n");
}
was (Author: mmayer):
I have a similar issue: if I invoke a simple MTOM-enabled Axis2 (v1.4.1)
service from a CXF (v2.1.3) client, the Axis2 service fails with the following
exception:
[ERROR] Referenced Attachment not found in the MIME Message. ContentID:[EMAIL
PROTECTED]://cxf.apache.org/
Caused by: org.apache.axiom.om.OMException: Referenced Attachment not found in
the MIME Message. ContentID:[EMAIL PROTECTED]://cxf.apache.org/
Looking at the message from the CXF client I realized that both, the cid-Url
and the Content-Id message header, were URL-encoded (although RFC 2111 states
the cid URL should be, the Content-Id message header not).
I fixed the problem by URL-decoding the Id of the Attachment in
org.apache.cxf.attachment.AttachmentSerializer:
private void writeHeaders(String contentType, String attachmentId, Writer
writer) throws IOException {
writer.write("\r\n");
writer.write("Content-Type: ");
writer.write(contentType);
writer.write("\r\n");
writer.write("Content-Transfer-Encoding: binary\r\n");
writer.write("Content-ID: <");
writer.write(URLDecoder.decode(attachmentId, "UTF-8"));
writer.write(">\r\n\r\n");
}
> Invalid ContentId Encode
> ------------------------
>
> Key: CXF-1900
> URL: https://issues.apache.org/jira/browse/CXF-1900
> Project: CXF
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.1.3
> Environment: Linux - Ubuntu 8.04
> Reporter: Andrea Bozzetto
>
> The namespace "urn:ihe:iti:xds-b:2007" is encoded in this way:
> Content-ID: <[EMAIL PROTECTED]>
> I change the class AttachmentUtil like this:
> /**
> * @param ns
> * @return
> */
> public static String createContentID(String ns) throws
> UnsupportedEncodingException {
> // tend to change
> String cid = URLEncoder.encode("http://cxf.apache.org/", "UTF-8");
> String name = UUID.randomUUID().toString();
> if (ns != null && (ns.length() > 0)) {
> try {
> URI uri = new URI(ns);
> String host = uri.toURL().getHost();
> cid = URLEncoder.encode(host, "UTF-8");
> } catch (URISyntaxException e) {
> e.printStackTrace();
> return null;
> } catch (MalformedURLException e) {
> cid = ns;
> }
> }
> return URLEncoder.encode(name, "UTF-8") + "@" + cid;
> }
> bye
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.