You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jeff Thorn <je...@thorntechnologies.com> on 2013/09/16 17:53:00 UTC

How to Add a Multipart-Related Child Attachment?

Hello Group,

I am trying to figure out how to add a child "multipart/related" attachment
as a sub attachment to the root attachment of a Message. Essentially what I
need to do is add an Attachment to a parent Attachment. The Web Service I
need to integrate with requires a SOAP Message with the following format:

POST
Content-Type: multipart/related; start="root"; boundary="-----part1"

------part1
Content-Type: text/xml
Content-Id: root
<soap:Envelope>.......< /soap:Envelope>

------part1
Content-Type: multipart/related; start="text-content";
boundary="------part2"
Content-Id: subattachment

------part2
Content-Type: text/plain
Content-Id: text-content

This is the text part of the message.

------part2
Content-Type: image/png
Content-Id: image-content
Content-Transfer-Encoding: base64

[base 64 binary data....]

------part2
------part1

I can figure out how to add attachments to the CXF Message using the
setAttachments() method. However, I cannot see how to add an Attachment to
an Attachment, as described in the sample above. Is this possible?

Thanks,
Jeff

Re: How to Add a Multipart-Related Child Attachment?

Posted by Sergey Beryozkin <sb...@gmail.com>.
I'll need something like this implemented for multipart/form-data 
payloads too, I'll have a look when I get a chance.
I guess we'd need to have CXF Attachment object to have a list of 
Attachment properties so Attachment serialization will become recursive, 
that would be a start.
If you can get to doing a patch then it would be welcome

Cheers, Sergey


On 16/09/13 16:53, Jeff Thorn wrote:
> Hello Group,
>
> I am trying to figure out how to add a child "multipart/related" attachment
> as a sub attachment to the root attachment of a Message. Essentially what I
> need to do is add an Attachment to a parent Attachment. The Web Service I
> need to integrate with requires a SOAP Message with the following format:
>
> POST
> Content-Type: multipart/related; start="root"; boundary="-----part1"
>
> ------part1
> Content-Type: text/xml
> Content-Id: root
> <soap:Envelope>.......< /soap:Envelope>
>
> ------part1
> Content-Type: multipart/related; start="text-content";
> boundary="------part2"
> Content-Id: subattachment
>
> ------part2
> Content-Type: text/plain
> Content-Id: text-content
>
> This is the text part of the message.
>
> ------part2
> Content-Type: image/png
> Content-Id: image-content
> Content-Transfer-Encoding: base64
>
> [base 64 binary data....]
>
> ------part2
> ------part1
>
> I can figure out how to add attachments to the CXF Message using the
> setAttachments() method. However, I cannot see how to add an Attachment to
> an Attachment, as described in the sample above. Is this possible?
>
> Thanks,
> Jeff
>