3
votes

how can I create a http/multipart response from a mule flow?

The outboundAttachments and outboundAttachmentFilenames are present and set but the received http response does not contain any attachment.

I tried a custom java component which uses the provided jersey classes to build a multipart response, but i can't find a working transformer to a mule response.

@Override
public Object onCall(MuleEventContext eventContext) throws Exception {
    MultiPart multiPart = new MultiPart();

    MuleMessage message = eventContext.getMessage();

    for (String attachmentName : message.getOutboundAttachmentNames()) {

        multiPart.bodyPart(new BodyPart(message.getOutboundAttachment(attachmentName), MediaType.APPLICATION_OCTET_STREAM_TYPE));
    }

    Response response = Response.status(200).entity(multiPart).type(MultiPartMediaTypes.MULTIPART_MIXED).build();

    return response;
}

The error is

Could not find a transformer to transform "SimpleDataType{type=com.sun.jersey.core.spi.factory.ResponseImpl, mimeType='text/xml'}" to "SimpleDataType{type=org.mule.api.transport.OutputHandler, mimeType='*/*'}".

I'm using Mule 3.5.0 EE.

Best regards, Marc

1

1 Answers

0
votes

This is a known issue that has been fixed in Mule 3.6.0.

See: https://www.mulesoft.org/jira/browse/MULE-7885

Either upgrade or ask MuleSoft to provide a backported patch for 3.5.x EE.