thots
thots

Reputation: 110

Mule Flow - Forward the multipart/form-data as is to the HTTP request inside the folow

Mule flow will receive multipart/form-data.

In the mule flow at runtime, I can see details of the multipart/form-data as attachments. When mule call the http request step in the flow to forward the multipart/form-data as is, mule seems to be not sending the incoming multipart/form-data.

In the log step prior to the http request,I can see all the attachments.

<flow name="impl-document:/upload">
        <logger message="Received attachments:  #[message.inboundAttachments.size()]"
            level="INFO" doc:name="Attachments Qty" />

        <foreach collection="#[message.inboundAttachments]" doc:name="For Each">
            <logger
                message="Attachment Key: #[key] -Key Value: #[message.payloadAs(java.lang.String)]"
                level="INFO" doc:name="Logger" />
        </foreach>
        <set-payload value="#[null]" doc:name="Set Payload as null" />

        <http:request config-ref="HTTP_Request_Configuration"
            path="nodes/upload" method="POST" doc:name="call to upload document">
        </http:request>

    </flow>

When I enhanced the log levels to track the http details, I see the content-length as -1 Content-Length: -1

I tried a few options like setting the content-type as Multipart/form but does not seems to be working. Any thoughts what I am missing in my flow would be really great.

Upvotes: 0

Views: 224

Answers (1)

afelisatti
afelisatti

Reputation: 2835

You need to copy the inbound attachments as outbound ones in order for the HTTP request to consider them and generate a multipart request. HTH

Upvotes: 1

Related Questions