I'm trying to get grab content out of multipart/form-data in Dataweave 2.2. I just want to send back the pdf from the second part of the payload. I am having no luck parsing through this payload using Dataweave.
My dataweave code is simply payload.parts
and I get the following error.
org.mule.runtime.core.api.expression.ExpressionRuntimeException: "Multipart Object does not have `parts` field defined. Expecting type is
{
preamble?: String,
parts: {
_*: {
headers: Object,
content: Any
}
}
}, while writing MultiPart at payload.parts." evaluating expression: "payload.parts".
Here is my payload. I trimmed the xml and file content for readability.
--MIMEBoundary_fdb504344c826b00b136f8946dec737661b743b37d6dc8c4
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.cdb504344c826b00b136f8946dec737661b743b37d6dc8c4@apache.org>
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"></soapenv:Envelope>
--MIMEBoundary_fdb504344c826b00b136f8946dec737661b743b37d6dc8c4
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <edb504344c826b00b136f8946dec737661b743b37d6dc8c4@apache.org>
%PDF-1.4
%����
1 0 obj
<<
/Creator (Smart Communications)
/Producer (Smart Communications)
/CreationDate (D:20200115094841-05'00')
>>
endobj
2 0 obj
<<
/N 3
/Length 3 0 R
/Filter /FlateDecode
>>
stream
x���wXS���sN�`$!l{��@