cancel
Showing results for 
Search instead for 
Did you mean: 

PDF base64 encoding string and JPEG Image base64 encoding string via Proxy from ECC to PI

Former Member
0 Kudos

Hi Experts,

Outbound Interface : ECC Proxy --------->PI---------->SOAP web service TargerSystem.

From ECC we need to get the PDF document and JPEG or PNG Image in Base64 Encoding string format via Proxy to PI .

Third Party provided WSDL . In WSDL we have two fields input file and Image have Base64 fields.

Third Party web service system expecting the PDF document in Base64 encoding string format for Input file field and JPEG Image in Base64 encoding string format for Image filed .

Please can you suggest me development approach for this requirement. from ECC side any Function Module is available for PDF and JPEG Image converting to Base64 encoding string format or we need to JAVA Mapping in PI .Please can you send me threads related to my requirement.

Thanks ,

Aadi

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Vila,

Thanks for your quick response.

Please can you send the code for JPEG or PNG Image file for converting Base 64 encoding string format. Third Party system expecting Logo Image for Image Base64 field in WSDL.

Thanks,

Aadi

iaki_vila
Active Contributor
0 Kudos

Hi,

The code that i shared is for all types of binaries files independently of the format. You would need to have the files accessible for ECC, i mean you should see them via AL11 transaction for example.

You can check the base64 result with online tools like Free Online Base64 Encoder / Base64 Decoder Tool - Freeencoder.com , taking the base64 from PI, before contact with your partner.

Regards.

iaki_vila
Active Contributor
0 Kudos

Hi,

I usually do it in the ECC, because is quicker and i avoid to do a java mapping to do the conversion. Check my code:



   DATA f_filename TYPE string.

   DATA f_base64 TYPE string.

   DATA f_fxs TYPE xstring.


  f_filename = im_path. "im_path is string type


   OPEN DATASET f_filename FOR INPUT IN BINARY MODE.


   IF sy-subrc <> 0.
"Error control
     EXIT.
   ENDIF.

   CLEAR f_fxs.
   READ DATASET f_filename INTO f_fxs.


   IF sy-subrc = 0.
     CLOSE DATASET f_filename.
   ELSE.
"Error control
     EXIT.
   ENDIF.

   CLEAR f_base64.


   CALL FUNCTION 'SSFC_BASE64_ENCODE'
     EXPORTING
       bindata                  = f_fxs
*     BINLENG                  =
     IMPORTING
       b64data                  = f_base64
     EXCEPTIONS
       ssf_krn_error            = 1
       ssf_krn_noop             = 2
       ssf_krn_nomemory         = 3
       ssf_krn_opinv            = 4
       ssf_krn_input_data_error = 5
       ssf_krn_invalid_par      = 6
       ssf_krn_invalid_parlen   = 7
       OTHERS                   = 8.



Finally i use the string to xsd:string in the PI XSD.


Hope this helps.


Regards.