Application Development and Automation 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: 
Read only

Base64 encoding not recognized

Former Member
0 Likes
2,787

Hi Gurus,

We are building Interface with Ariba using web service method. Requirement from Ariba is SAP needs to send 5 files then zipped it and encode it into base64 format.

Below is my code snipet .

DATA  lv_contents TYPE arbfnd_attachment_content,

Do 5 times.

OPEN DATASET gv_file FOR INPUT IN BINARY MODE.

   IF sy-subrc EQ 0.

     DO.

      READ DATASET gv_file INTO lv_xstring.

       IF sy-subrc EQ 0.

        EXIT.

       ENDIF.

     ENDDO.

   ENDIF.

   CLOSE DATASET gv_file.

  DATA: lv_filename TYPE string.

   lv_filename = p_filename.


   CALL METHOD go_zipper->add

     EXPORTING

       name    = lv_filename

       content = lv_xstring.

Enddo.

CALL METHOD go_zipper->save

     RECEIVING

       zip = gv_zip.

CALL FUNCTION 'SCMS_BASE64_ENCODE_STR'

     EXPORTING

       input  = gv_zip

     IMPORTING

       output = lv_encoded_b64.


EXPORT my_data = lv_encoded_b64 TO DATA BUFFER lv_buffer.

IMPORT my_data TO lv_contents FROM DATA BUFFER lv_buffer IN CHAR-TO-HEX MODE.

My problem is to send encoded base64 xstring to Ariba.

But as per my understanding base64 format is string, thats why I convert the value from string to xstring after being encoded.

Now I'm receiving error from my webservice saying there is serialization/deserialization error.

Please advice am I missing some step or is it because the base64 format provided by abap is different with what Ariba is expeceted.

Regards,

AT

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,804

If you have a XSTRING field as a return parameter (or a component) of your webservice, it will be transformed automatically to base 64. So just use gv_zip and remove the explicit conversions.

2 REPLIES 2
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,805

If you have a XSTRING field as a return parameter (or a component) of your webservice, it will be transformed automatically to base 64. So just use gv_zip and remove the explicit conversions.

Read only

0 Likes
1,804

Thanks Sandra,

This clarification is exactly what I need.

I have try to follow your suggestion error 'SOAP:1027 SRT: Serialization / Deserialization failed' still persist but web method successfully executed with document response.


At least now I know now that error was generic and its not something that always related with encoding and decoding of base64.



Thanks,

AT