RestSharp latest version breaks my API's post method (add Guid before and after the body) - nuget

Since latest version of RestSharp, all my post API's are failing because something has been added to the bodies I send.
Looks like a Guid id is generated and is added before and after the body for each call; the issue is it's not accepted by all my API's providers.
FYI, I created 2 identical console apps, one with version "106.12.0", and one with latest version "107.3.0". please see below the result:
Thanks in advance to help me with this
BR
-Vince
Examples:
Working with Version="106.12.0" :
before:
Content-Type: text/plain; charset=utf-8
Content-Disposition: form-data; name="application/xml"
<SMSBoxXMLRequest>
<username>cnoxxxx</username>
<!-- password hidden -->
<command>WEBSEND</command>
<parameters>
<service>VALAIS</service>
<text>Test de Message Sms 1</text>
<test></test>
<receiver>+4177222333444</receiver>
</parameters>
</SMSBoxXMLRequest>
after:
Not Working with Version="107.3.0" :
**--497993c6-3ef7-47fb-b527-403c1eefedf8**
Content-Type: text/plain; charset=utf-8
Content-Disposition: form-data; name="application/xml"
<SMSBoxXMLRequest>
<username>cnoxxxx</username>
<!-- password hidden -->
<command>WEBSEND</command>
<parameters>
<service>VALAIS</service>
<text>Test de Message Sms 1</text>
<test></test>
<receiver>+4177222333444</receiver>
</parameters>
</SMSBoxXMLRequest>
**--497993c6-3ef7-47fb-b527-403c1eefedf8--**
**--3277a8db-bd83-4f3c-af2e-d34efe76fe98**
Content-Type: text/plain; charset=utf-8
Content-Disposition: form-data; name="application/xml"
<SMSBoxXMLRequest>
<username>cnoxxxx</username>
<!-- password hidden -->
<command>WEBSEND</command>
<parameters>
<service>VALAIS</service>
<text>Test de Message Sms 2</text>
<test></test>
<receiver>+4177222333444</receiver>
</parameters>
</SMSBoxXMLRequest>
**--3277a8db-bd83-4f3c-af2e-d34efe76fe98--**
**--5b81fa95-a0b9-4f5c-9242-742734b0241e**
Content-Type: text/plain; charset=utf-8
Content-Disposition: form-data; name="application/xml"
<SMSBoxXMLRequest>
<username>cnoxxxx</username>
<!-- password hidden -->
<command>WEBSEND</command>
<parameters>
<service>VALAIS</service>
<text>Test de Message Sms 3</text>
<test></test>
<receiver>+4177222333444</receiver>
</parameters>
</SMSBoxXMLRequest>
**--5b81fa95-a0b9-4f5c-9242-742734b0241e-**-

Related

Invalid mime format

while uploading file to irs in mef ifa platform, when file is uploaded its preliminary validation failed and an error occurred "invalid mime format".
I have tried in many ways and with different formats but not fixed.
Here is my file to transmit
MIME-Version: 1.0
Content-Type: multipart/related;
boundary=MIMEBoundary941; Content-Type: text/xml; charset=UTF-8
Content-Description: Transmission File containing one Submission.
X-eFileRoutingCode: MEF
--MIMEBoundary941
Content-Type: text/xml
Content-Transfer-Encoding: 8bit
Content-Location: Envelope941
<?xml version="1.0" encoding="UTF-8"?>
<SOAP:Envelope xmlns="http://www.irs.gov/efile"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:efile="http://www.irs.gov/efile"
xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ ../message/SOAP.xsd
http://www.irs.gov/efile ../message/efileMessage.xsd">
<SOAP:Header>
<TransmissionHeader>
<TransmissionId>******</TransmissionId>
<Timestamp>2022-07-18T14:05:57+06:43</Timestamp>
<Transmitter>
<ETIN>******</ETIN>
</Transmitter>
</TransmissionHeader>
</SOAP:Header>
<SOAP:Body>
<TransmissionManifest>
<SubmissionDataList>
<Count>1</Count>
<SubmissionData>
<SubmissionId>*******************</SubmissionId>
<ElectronicPostmark>2022-06-30T14:05:57+06:43</ElectronicPostmark>
</SubmissionData>
</SubmissionDataList>
</TransmissionManifest>
</SOAP:Body>
</SOAP:Envelope>
--MIMEBoundary941
Content-Type: application/octet-steam
Content-Transfer-Encoding: Binary
Content-Location: SubmissionZip
<<ZipFile here >>
--MIMEBoundary941—

Axis2 sending multipart response when content-type is "text/xml"

Axis2 by default is send a multipart response even when there are no attachments
Why is axis2 sending a multipart response & how to ask it to send a "application/xml" or "application/soap+xml" how to get rid of multipart?
In the axis2.xml I have
In the response I see
HTTP/1.1 200 OK
Date: Fri, 17 Feb 2017 01:07:08 GMT
Transfer-Encoding: chunked
Content-Type: multipart/related; boundary="MIMEBoundary_87162747c87b279f7caa4e1ab573d5d864a878de7fae1a0b"; type="application/xop+xml"; start="<0.97162747c87b279f7caa4e1ab573d5d864a878de7fae1a0b#apache.org>"; start-info="text/xml"
--MIMEBoundary_87162747c87b279f7caa4e1ab573d5d864a878de7fae1a0b
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.97162747c87b279f7caa4e1ab573d5d864a878de7fae1a0b#apache.org>
200<?xml version="1.0" encoding="UTF-8"?>
<List_Wrapper>
<_bp>
<_comments><_comment><content>Again a new comment this is a text type bp comment need to see this in the text json 1</content><published_date>2017-01-18T21:07:15</published_date><published_by>cyril furtado</published_by><company>Chevron Inc.</company></_comment></_comments></_bp>
</List_Wrapper>
--MIMEBoundary_87162747c87b279f7caa4e1ab573d5d864a878de7fae1a0b-
I too faced similar issue for AXIS 2 quite recently , so thought to answer this.
AXIS 2 by default support attachment processing globally, which might not be needed for all types of services. To resolve this issue I disabled MTOM processing globally by modifying axis2.xml file -
<parameter name="enableMTOM">false</parameter>
This capability can now be enabled on need basis per service basis by enabling this property via respective services.xml file

Which Content-Transfer-Encoding should I use?

I am programmatically sending a Content-Type': 'multipart/form-data to an endpoint and my system (Ubuntu) is default on UTF-8.
My question is, which Content-Transfer-Encoding should/do I use?
Here is an example of a form part:
Content-Disposition: form-data; name="to"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: ?
jacob#example.com
Which Content-Transfer-Encoding would be the safest to use?
Another example:
Content-Disposition: form-data; name="message"; filename="message.mime"
Content-Type: message/rfc822; charset=UTF-8
Content-Transfer-Encoding: ?
From: jacob#example.com
To: jacob#example.com
Subject: testing Coreor
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
testing Coreor
I have updated my code to use quoted-printable, so I now send the below.
It works, but do you see any errors, problems or optimizations?
--x.ai/coreor=---14187500275550.5525101518724114
Content-Disposition: form-data; name="to"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
jacob#example.com
--x.ai/coreor=---14187500275550.5525101518724114
Content-Disposition: form-data; name="message"; filename="message.mime"
Content-Type: message/rfc822; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Mailer: x.ai Coreor v1.test
From: =22Jacob=22 <jacob#example.com>
To: jacob#example.com
Subject: testing Coreor via Mailgun
Content-Type: text/plain; charset=3Dutf-8
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
testing Coreor
--x.ai/coreor=---14187500275550.5525101518724114--
I use mimelib for the quoted-printable encoding.

OSB email - forcing multipart/mixed

I am sending email using a OSB (11.1.1.6) service.
Some email clients do not pick up the attachments.
We have narrowed down the problem down to MIME Content-Type.
Going through OSB it sets the Content-Type to multipart/related. In order to get it to work (we tested this using ncat) we need to set the Content-Type to multipart/mixed.
I cannot however find any way to force OSB to set it to multipart/mixed.
This message does not display the attachment on some clients:
From: <nothing#example.com>
To: nothing#example.com
Message-ID: <xxx>
Subject: Subject 123
MIME-Version: 1.0
Content-Type: multipart/related; boundary="MIME_Boundary";
start=1389578236803081255-2926c9b7.148d69bfba8.7396
Return-Path: nothing#example.com
--MIME_Boundary
Content-ID: 1389578236803081255-2926c9b7.148d69bfba8.7396
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
<h1>Head</h1>
<p>Paragraph <b>bold</b></p>
--MIME_Boundary
Content-Type: text/plain; name="TEST.txt"
Content-Transfer-Encoding: base64
Content-Description: TEST.txt
Content-Disposition: attachment; filename="TEST.txt"
VGVzdGluZyAxMjM=
--MIME_Boundary--
This message displays the attachment:
From: <nothing#example.com>
To: nothing#example.com
Message-ID: <xxx>
Subject: Subject 123
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="MIME_Boundary";
start=1389578236803081255-2926c9b7.148d69bfba8.7396
Return-Path: nothing#example.com
--MIME_Boundary
Content-ID: 1389578236803081255-2926c9b7.148d69bfba8.7396
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
<h1>Head</h1>
<p>Paragraph <b>bold</b></p>
--MIME_Boundary
Content-Type: text/plain; name="TEST.txt"
Content-Transfer-Encoding: base64
Content-Description: TEST.txt
Content-Disposition: attachment; filename="TEST.txt"
VGVzdGluZyAxMjM=
--MIME_Boundary--
As you can see the only difference is the Content-Type.
So how do I force OSB to set the Content-Type to multipart/mixed ?
You can set the Transport Header Content-Type. I assume you are using the routing to call the BS service which has email configuration. From Proxy, where you are routing, in the request actions, add Communication > Transport Headers. From the drop down, select emails >> Content-Type.
After some communication with Oracle support we were pointed to apply patch 12585136.
This was one of the bugs fixed for OSB 11.1.1.7 (link)
12585136 - The Email transport generates multipart/related emails and not mulitpart/mixed
After we have applied and tested the patch I will update this answer with more feedback.

Malformed multipart body youtube video upload

I am trying to upload video to youtube from iPhone app. But i am getting "Malformed multipart body".
Here is my request format :-
Headers :
Authorization: Bearer ya29.AHES6ZRfVWRgOe78g4eHz8v85yFztU-ea3jEy6d_4mbEkAMVD33_1w
GData-Version: 2
Host: uploads.gdata.youtube.com
X-GData-Key: key=AI39si5TXQBExBk3eT3cn4eCOSKr1GEOJd5_HJ-RjUGPErby1Qn4aOL-HlecdrxZ3Ur7QocO8Di9wHxUdV2fSYTM3mtFCyzl_A
Slug: summer_vacation.mp4
Content-Type: multipart/related; boundary="f93dcbA3"
Request Body:
--f93dcbA3
Content-Type: application/atom+xml; charset=UTF-8
<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:yt="http://gdata.youtube.com/schemas/2007">
<media:group>
<yt:incomplete/>
<media:category
scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Travel
</media:category>
</media:group>
</entry>
--f93dcbA3
Content-Type: video/mp4
Content-Transfer-Encoding: binary
--f93dcbA3--
Please help me.
I think it is because of the extra line after your second boundary (just before the Content-Type: video/mp4 header). Also, be sure to add a line between the Content-Transfer-Encoding: binary header and your binary data.
Take the Google Example as model :
POST /feeds/api/users/default/uploads HTTP/1.1
Host: uploads.gdata.youtube.com
Authorization: Bearer ACCESS_TOKEN
GData-Version: 2
X-GData-Key: key=adf15ee97731bca89da876c...a8dc
Slug: video-test.mp4
Content-Type: multipart/related; boundary="f93dcbA3"
Content-Length: 1941255
Connection: close
--f93dcbA3
Content-Type: application/atom+xml; charset=UTF-8
<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:yt="http://gdata.youtube.com/schemas/2007">
<media:group>
<media:title type="plain">Bad Wedding Toast</media:title>
<media:description type="plain">
I gave a bad toast at my friend's wedding.
</media:description>
<media:category
scheme="http://gdata.youtube.com/schemas/2007/categories.cat">People
</media:category>
<media:keywords>toast, wedding</media:keywords>
</media:group>
</entry>
--f93dcbA3
Content-Type: video/mp4
Content-Transfer-Encoding: binary
<Binary File Data>
--f93dcbA3--