cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CPI - Sending .pdf file as a multipart form Integration Flow

HariKotaru
Newcomer
0 Kudos

Hello All,

I have scenario where I need to post multipart form .pdf file to http client using SAP CPI.

Data should be in the below format

Content-Type: multipart/form-data
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Field1"

Value1
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Field2"

Value2

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Field3"

Value3
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="file.pdf"
Content-Type: application/pdf

Payload
----WebKitFormBoundary7MA4YWxkTrZu0gW--

I tried to use the content modifier but my payload is getting corrupted. tried to follow the blog

https://answers.sap.com/questions/12716088/sap-cpi-forwarding-raw-image-data-through-integrat.html

But by using mail library I can't set multiple body parameters.

I tried to use the below library in my groovy script, but MultipartEntityBuilder throwing exception.

org.apache.http.entity.mime.MultipartEntityBuilder;

Could someone please suggest me the right approach.

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member608139
Active Participant
0 Kudos

Did you tryed to use the "MIME MUTIPAR ENCODER"?

gabrielrd
Member
0 Kudos

Hello! All good?

I come across the same doubt.

I'm trying to upload .PDF files to Azure Blob using open connector. As soon as I check them there and download them to my machine, I see that they are corrupt...

I've been researching about the multipart/form-data structure, the MIME Multipart Encoder component and etc, but I haven't been successful yet. In the end the file is corrupted.