cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Document from Base64 iPhone picture

mike_reader3
Active Participant
0 Kudos

Hello,

I have a Gateway service setup to receive a photo (as Base64), the service field is typed as Edm.String, the subsequent FM that gets called has an field typed as String as well.

I am pretty sure the Base64 is coming across ok (took the base64 from the request and stuck it in a online converter), what I am trying to do is create a Document based on this jpg.

After some research it seems I am supposed to use:

SSFC_BASE64_DECODE

then

SCMS_XSTRING_TO_BINARY

I am attempting to create this jpg on the server then create the Document from that using

CV120_DOC_GET_APPL

I think the issue is coming after SCMS_XSTRING_TO_BINARY when I am transferring the itab to the dataset.

My code runs successfully, the Document is created and the jpg shows up as part of the Document (confirmed in CV03N), but when I try and open the jpg, I just get the message 'Failed to open document"

Looking for any thoughts or ideas.

-Mike

Accepted Solutions (1)

Accepted Solutions (1)

mike_reader3
Active Participant
0 Kudos

Figured it out ....

There was some mime type info at the beginning of the Base64 that I had to peel out

Ex:

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABI...


I had to remove the text in bold, after that it worked fine.


Another note, I did not need to make the call to SCMS_XSTRING_TO_BINARY, I was able to output the result from SSFC_BASE64_DECODE to the dataset.


-Mike

Answers (0)