‎2016 Sep 29 9:32 AM
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
‎2016 Sep 29 10:07 AM
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.
‎2016 Sep 29 10:07 AM
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.
‎2016 Sep 29 10:23 AM
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