You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Shultz, Dmitry" <Dm...@kaltire.com> on 2019/09/25 02:04:44 UTC

Mime Multipart DataFormat+ HTTP4 (POST)

Hi All,

Is there any code sample of how to use the Mime Multipart DataFormat (https://camel.apache.org/components/latest/mime-multipart-dataformat.html) for sending some xml payload using HTTP4 component? I need to send it to the REST service using POST and can't figure it out.

Cheers,
Dmitry

RE: Mime Multipart DataFormat+ HTTP4 (POST)

Posted by "Shultz, Dmitry" <Dm...@kaltire.com>.
In case anybody stumble upon the same thing, here is how I did it (not using Multipart Dataformat):

...
.bean(UploadBean.class, "createMultipartEntity")
...

public HttpEntity createMultipartEntity(@ExchangeProperty("invoice") String invoice, @ExchangeProperty("orderId") String orderId) {
        return MultipartEntityBuilder.create()
                .addBinaryBody("entity", invoice.getBytes(), ContentType.APPLICATION_JSON, orderId)
                .build();
}

Cheers,
Dmitry

-----Original Message-----
From: Shultz, Dmitry [mailto:Dmitry_Shultz@kaltire.com] 
Sent: Tuesday, September 24, 2019 7:05 PM
To: users@camel.apache.org
Subject: Mime Multipart DataFormat+ HTTP4 (POST)

Hi All,

Is there any code sample of how to use the Mime Multipart DataFormat (https://urldefense.proofpoint.com/v2/url?u=https-3A__camel.apache.org_components_latest_mime-2Dmultipart-2Ddataformat.html&d=DwIFAg&c=KMGz4T0TsfsPtvlb4OD1oA&r=t6OzuNuL86YgAzDSNmWJog3VjIcQB0sodMSERnX0MWo&m=o0gjHjq1dUVfRYnGuSS19BuCudYu0-kygp97FNfBjNc&s=d7bdGL0OQdmvf7TQSpwgzHd38IsLtqQ4DNz3DwsprM8&e= ) for sending some xml payload using HTTP4 component? I need to send it to the REST service using POST and can't figure it out.

Cheers,
Dmitry