Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Add MIME to XML

bjorn-henrik_zink
Active Participant
0 Kudos

Hi,

what would be the best way to add a MIME object to XML?

I am reading the MIME object with class CL_MIME_REPOSITORY_API. I am unsure how to get the XSTRING into a suitable XML format.

Thanks.

/Björn-Henrik

4 REPLIES 4

Sandra_Rossi
Active Contributor
0 Kudos

If MIME object is a binary, it's usually stored in base 64 (please search forum with this term), and if it's a text, it is usually stored as text in UTF-8 encoding but it may be UTF-16 for Asian or some rare languages. In fact, it depends on the DTD or XSD that defines your XML structure.

0 Kudos

Hi Sandra,

thanks for your reply, it helped me solve the issue. Here is how I solved it for MIME images

1. Get XSTRING of MIME image

2. SCMS_XSTRING_TO_BINARY

3. SCMS_BINARY_TO_STRING

4. cl_http_utility=>if_http_utility~encode_base64

/Björn-Henrik

0 Kudos

Well done. Thx for the feedback.

0 Kudos

Hi again,

I just found function module SCMS_BASE64_ENCODE_STR, which makes it even easier:

1) Get MIME XSTRING using class CL_MIME_REPOSITORY_API

2) Convert XSTRING with function module SCMS_BASE64_ENCODE_STR

/Björn-Henrik