Forum Discussion

alvin's avatar
14 years ago

Content Transfer Encoding

Hi, i am testing services for a system which uses MIME attachments. Sending Text and XML attachments work fine but binary attachments such as PDF documents dont work, that is when trying to access the attachment from the downstream system they are corrupted / dont open.

Resending the request with PDF attachment but forcing the Content Type(of the attachment) to be "text/plain" in SOAP UI results in the attachments working fine, when doing this the encoding used by SOAP UI is "Base64" where as if they content type is left as "application/pdf" then the content transfer encoding used is "Binary".

Is it possible to configure SOAP UI to use Base64 content transfer encoding for content type of application/pdf etc.

Below is summarised example of what is happening to the request.

Using Content Type =application / pdf
Content-Type: multipart/related; type="text/xml"; start="<rootpart@soapui.org>"; boundary="----=_Part_46_11379381.1293145587498"
MIME-Version: 1.0
User-Agent: Jakarta Commons-HttpClient/3.1
Host:
Content-Length: 274429


------=_Part_46_11379381.1293145587498
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <rootpart@soapui.org>

MY SOAP REQUEST

------=_Part_46_11379381.1293145587498
Content-Type: application/pdf; name=somepdf.pdf
Content-Transfer-Encoding: binary
Content-ID: <esx3_best_practices.pdf>
Content-Disposition: attachment; name="somepdf.pdf"; filename="somepdf.pdf"

%PDF-1.6
%âãÏÓ
175 0 obj <</Linearized 1/L 272157/O 181/E 34347/N 13/T 268593/H [ 1693 595]>>

trailer
<</Size 243/Prev 268581/Root 177 0 R/Encrypt 176 0 R/Info 174 0 R/ID[<86085EAF3BC25C083E6C34341F8EF600><A3DC04978D5F794BB3A60B55807AC1C8>]>>
startxref
0
%%EOF

242 0 obj<</Length 495/E 740/Filter/FlateDecode/I 756/O 724/S 531/T 667>>stream
êîëðD%—Ö —})�³½Ô©~\s¬î•ñT2\ ‘—¤´ÉÙF‚z›Ü
© g] ø‰sŸ àù ¾Ñ§) b¯ a¸gÎkA
z¬œ;èj\ ý�žÇa/Vy rû ß)/Ø:¿Ç*X#5l §jn€Ca ¶cÍ ¾ø‚ŒíÉö7JKé_” ­*î" È0ÕÁF
------=_Part_46_11379381.1293145587498

Using text/plain with PDF attachment

Content-Type: multipart/related; type="text/xml"; start="<rootpart@soapui.org>"; boundary="----=_Part_47_31845142.1293146159871"
MIME-Version: 1.0
User-Agent: Jakarta Commons-HttpClient/3.1
Host:
Content-Length: 374702


------=_Part_47_31845142.1293146159871
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <rootpart@soapui.org>
MY SOAP REQUEST

------=_Part_47_31845142.1293146159871
Content-Type: text/plain; charset=Cp1252; name=somepdf.pdf
Content-Transfer-Encoding: base64
Content-ID: <esx3_best_practices.pdf>
Content-Disposition: attachment; name="somepdf.pdf"; filename="somepdf.pdf"

JVBERi0xLjYNJeLjz9MNCjE3NSAwIG9iaiA8PC9MaW5lYXJpemVkIDEvTCAyNzIxNTcvTyAxODEv
RSAzNDM0Ny9OIDEzL1QgMjY4NTkzL0ggWyAxNjkzIDU5NV0+Pg1lbmRvYmoNICAgICAgICAgICAg
DQp4cmVmDQoxNzUgNjgNCjAwMDAwMDAwMTYgMDAwMDAgbg0KMDAwMDAwMjI4OCAwMDAwMCBuDQow
MDAwMDAyNDIzIDAwMDAwIG4NCjAwMDAwMDI2MDYgMDAwMDAgbg0KMDAwMDAwMjYzMiAwMDAwMCBu
DQowMDAwMDAyNjc4IDAwMDAwIG4NCjAwMDAwMDI3MTMgMDAwMDAgbg0KMDAwMDAwMjkyNyAwMDAw
MCBuDQowMDAwMDAzMDA1IDAwMDAwIG4NCjAwMDAwMDMwODEgMDAwMDAgbg0KMDAwMDAwMzE1OSAw
MDAwMCBuDQowMDAwMDAzMjM2IDAwMDAwIG4NCjAwMDAwMDMzMTMgMDAwMDAgbg0KMDAwMDAwMzM5
MCAwMDAwMCBuDQowMDAwMDAzNDY3IDAwMDAwIG4NCjAwMDAwMDM1NDQgMDAwMDAgbg0KMDAwMDAw
MzYyMSAwMDAwMCBuDQowMDAwMDAzNjk4IDAwMDAwIG4NCjAwMDAwMDM3NzUgMDAwMDAgbg0KMDAw
MDAwMzg1MiAwMDAwMCBuDQowMDAwMDAzOTI5IDAwMDAwIG4NCjAwMDAwMDQxMDMgMDAwMDAgbg0K
MDAwMDAwNDE4MyAwMDAwMCBuDQowMDAwMDA0NjE0IDAwMDAwIG4NCjAwMDAwMDUzMDQgMDAwMDAg
bg0KMDAwMDAwNTQwMSAwMDAwMCBuDQowMDAwMDA1NDk3IDAwMDAwIG4NCjAwMDAwMDYzMDggMDAw
MDAgbg0KMDAwMDAwNzA0OCAwMDAwMCBuDQowMDAwMDA3NzIwIDAwMDAwIG4NCjAwMDAwMDgyNTYg
MDAwMDAgbg0KMDAwMDAwODgxMiAwMDAwMCBuDQowMDAwMDA5NDMzIDAwMDAwIG4NCjAwMDAwMTM4
MDUgMDAwMDAgbg0KMDAwMDAxNDIzMCAwMDAwMCBuDQowMDAwMDE0NjI0IDAwMDAwIG4NCjAwMDAw
MTQ4NzIgMDAwMDAgbg0KMDAwMDAxOTI4MCAwMDAwMCBuDQowMDAwMDE5NzAyIDAwMDAwIG4NCjAw
------=_Part_47_31845142.1293146159871

As mentioned the base64 content transfer encoding works, is it possible to use base64 encoding with content type "application/pdf"

Thanks
Alvin
No RepliesBe the first to reply