Set Content-Disposition on MIME body part on Content-Type multipart/form-data

What product/components do you use and which version/fix level are you on?

10.11

Is your question related to the free trail, or to a production (customer) instance?

Customer Instance

What are you trying to achieve? Please describe in detail.

Hello, I want to ask, I have a use case that I need to generate POST request to the surrounding system using Content-Type: multipart/form-data that are parsed from IData objects, i tried to explore some threads on the forum, i kind of get the flow of generating MIME message, but i still have problem at generating Content-Disposition for the MIME Message, below are the example MIME Message i generated, also my body content supposed to be partnerReferenceNumber:1231231111
any ideas, why it becoming String value:value not key:value, also did i miss something like boundary thing?

User-Agent: Mozilla/4.0 [en] (WinNT; I)
Host: localhost:5555
Authorization: Basic QWRtaW5pc3RyYXRvcjptYW5hZ2U=
Content-Type: multipart/form-data
Date: Sat, 6 Aug 2022 18:35:56 +0700 (ICT)
Message-ID: <1342480065.3.1659785756300@VincentKo>
MIME-Version: 1.0
Content-Length: 285

------=_Part_2_1439115527.1659785756298
Date: Sat, 6 Aug 2022 18:35:56 +0700 (ICT)
Message-ID: <729251826.1.1659785756297@VincentKo>
MIME-Version: 1.0
content-type: text/plain
content-transfer-encoding: 7bit
1231231111: 1231231111


------=_Part_2_1439115527.1659785756298--

I think the right MIME Message supposed to be like this

POST / HTTP/1.1
Host: localhost:8000
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:29.0) Gecko/20100101 Firefox/29.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: __atuvc=34%7C7; permanent=0; _gitlab_session=226ad8a0be43681acf38c2fab9497240; __profilin=p%3Dt; request_method=GET
Connection: keep-alive
Content-Type: multipart/form-data; boundary=---------------------------9051914041544843365972754266
Content-Length: 554

-----------------------------9051914041544843365972754266
Content-Disposition: form-data; name="text"

text default
-----------------------------9051914041544843365972754266
Content-Disposition: form-data; name="file1"; filename="a.txt"
Content-Type: text/plain

Content of a.txt.

-----------------------------9051914041544843365972754266
Content-Disposition: form-data; name="file2"; filename="a.html"
Content-Type: text/html

<!DOCTYPE html><title>Content of a.html.</title>

-----------------------------9051914041544843365972754266--

Hi Vincent,
Can you please let us know which product you are trying this on?

Regards.

Check for the mime body data if you are passing the key name there in the pub.mime service.

I’m following this thread

I’m able to generate the Mime Message correctly but the Content-Type generated by IS is multipart/mixed instead of multipart/form-data, are they both the same?

User-Agent: Mozilla/4.0 [en] (WinNT; I)
Host: localhost:5555
Authorization: Basic QWRtaW5pc3RyYXRvcjptYW5hZ2U=
Content-Type: multipart/mixed; boundary="----=_Part_2_272149066.1659948795948"
Date: Mon, 8 Aug 2022 15:53:15 +0700 (ICT)
Message-ID: <609641145.3.1659948795953@VincentKo>
MIME-Version: 1.0
Content-Length: 718

------=_Part_2_272149066.1659948795948
content-type: text/plain
content-transfer-encoding: 7bit
Content-Disposition: form-data; name=jsonListObjectGadai

{"channel":"MSM","deviceId":"VAMS"}
------=_Part_2_272149066.1659948795948
content-type: text/plain
content-transfer-encoding: 7bit
Content-Disposition: form-data; name=partnerReferenceNumber

123123123
------=_Part_2_272149066.1659948795948
content-type: text/plain
content-transfer-encoding: 7bit
Content-Disposition: form-data; name=gadaiVar

[{  "BeratEmas": 10000,  "JumlahEmas": 1,  "Karatase": 17,  "Karatase_title": "17 Karat",  "ObjectGadai": "Logam Mulia/Batangan",  "ObjectGadaiCode": "LM1"}]
------=_Part_2_272149066.1659948795948--

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.