Smartform : PDF to Base64 encoding

Hi .
I am new to ABAP & Smartform.I have a requirement to convert smartform PDF to Base 64.I've tried the methods provided in the related SDN threads.But while decoding , junk characters are coming.Please find my code below :
Convert SF output to PDF format
*convert the smartform to .pdf file
      DATA : I_DOC TYPE TABLE OF DOCS,
                   WA_DOC TYPE DOCS,
                   L_PDF_STRING TYPE XSTRING.
      I_OTFDATA[] = ST_JOB_OUTPUT_INFO-OTFDATA[].
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
          MAX_LINEWIDTH         = 132
        IMPORTING
          BIN_FILESIZE          = V_BIN_FILESIZE
          BIN_FILE              = L_PDF_STRING
        TABLES
          OTF                   = I_OTFDATA
          LINES                 = I_LINES.
Convert Table i_bin to base64 encoding
  DATA : I_BASE64  TYPE STANDARD TABLE OF SOLISTI1,
         WA_BASE64 TYPE SOLISTI1,
         WA_LINES  TYPE TLINE.
  DATA: LV_OUTPUT(255) TYPE C,
        LV_INPUT(132) TYPE C,
        LV_X(255) TYPE X,
        LV_I TYPE I.
  DATA: CONV TYPE REF TO CL_ABAP_CONV_OUT_CE.
  LOOP AT I_LINES INTO WA_LINES.
    LV_INPUT = WA_LINES-TDLINE.
    LV_I = STRLEN( LV_INPUT ).
   CONDENSE lv_input.
    IF LV_I > 0.
      TRY.
          CALL METHOD CL_ABAP_CONV_OUT_CE=>CREATE
            EXPORTING
              ENCODING    = 'UTF-8'
              ENDIAN      = 'L'
              replacement = '#'
              ignore_cerr = ABAP_FALSE
            RECEIVING
              CONV        = CONV .
        CATCH CX_PARAMETER_INVALID_RANGE .
        CATCH CX_SY_CODEPAGE_CONVERTER_INIT .
      ENDTRY.
              CALL METHOD CONV->WRITE
            EXPORTING
              N      = LV_I
              DATA   = LV_INPUT
            view   =
          IMPORTING
            len    =
          LV_X = CONV->GET_BUFFER( ).
      CALL FUNCTION 'HTTP_BASE64_ENCODE'
        EXPORTING
          INPUT        = LV_X
          INPUT_LENGTH = LV_I
        IMPORTING
          OUTPUT       = LV_OUTPUT.
    Append to Table
      WA_BASE64-LINE = LV_OUTPUT.
      APPEND WA_BASE64 TO I_BASE64.
      CLEAR : LV_OUTPUT, LV_X, LV_I, WA_BASE64, WA_LINES.
    ENDIF.
  ENDLOOP.
Thanks,
Jayita Ganguly

Hi,
Jayita2011 wrote:
LV_X = WA_PDF-TDLINE.
As WA_PDF-TDLINE is type C, and LV_X is type X, it does a conversion BUT it is not what you expect: LV_X = 'RMjlùIOJM%8RUZ3T', it will set LV_X = all zeroes as 'RM...' does not start with an hexadecimal string (and so base 64 would return AAAAAA). See the ABAP doc for more info.
Moreover, base 64 encoding must be done with the whole byte stream (more precisely you must not split it outside chunks of 3 bytes, as this encoding converts 3 bytes into 4 characters, converting 2 bytes makes no sense for example, except at the end of the stream).
I advise you to use CL_HTTP_UTILITY=>ENCODE_BASE64 which converts a string which is casted as bytes. Before, you must concatenate the lines into a string, either using CONCATENATE LINES OF lt_char INTO l_target RESPECTING BLANKS, or SWA_STRING_FROM_TABLE (keep_trailing_spaces='X') depending on your release. Don't forget to shorten the string at exactly the number of representative characters (LV_I in your example).
BR
Sandra

Similar Messages

  • Convert PDF to Base64

    Hello everyone,
    We have implemented in our SAP the Digital Invoice Mexico. We send a XML file based on the billing document according of all SAP Notes. This process was perfect.
    Now we have a customer that need to receive a PDF file encoding in base64. This value need to be send in XML file, so I need generate this code and insert this value in XML file.
    We wold like to know if there are some function in SAP that could convert this file PDF in base64.
    Thanks in advanced
    Mary Nuvoloni

    Check this link PDF to BASE64 conversion
    I suggest you to post in ABAP forum.
    Regards,

  • Improper decoding of base64 encoded attachment on Exchange 2007 SP1

    I'm using Exchange 2007 SP1. My java application sends email to users of exchange 2007 SP1. The email contains an email as an attachment which is base64 encoded . This email when sent to users on exchange 2007 SP1 shows blank attachment. The same email when sent to users on different exchange (e.g. Exchange 2003) shows the correct attachment i.e. the attachments are not blank. While sending the mail i'm setting name of the attachment in Content-Type header but it is not there when we look at the rfc contents of the mail received on ex 2007 SP1.  It seems exchange 2007 is not able to decode the base 64 contents properly. Below are the rfc contents of the mail which show few headers in the attachment part instead of the base64 content. Please suggest some solution to it. It's urgent.
    Received: from test80.psjpr.com (192.168.0.243) by exchange01.psjpr.com
     (192.168.0.138) with Microsoft SMTP Server id 8.1.263.0; Fri, 11 Apr 2008
     18:53:12 +0530
    From: Admin <[email protected]>
    To: test test1 <[email protected]>
    Date: Fri, 11 Apr 2008 18:53:12 +0530
    Subject: Retrieved from : testingggggg
    Thread-Topic: Retrieved from : testingggggg
    Thread-Index: Acib1zFeboxSL6S4RuaeI0AaCou0pQ==
    Message-ID: <[email protected]>
    Accept-Language: en-US
    Content-Language: en-US
    X-MS-Exchange-Organization-AuthAs: Anonymous
    X-MS-Exchange-Organization-AuthSource: exchange01.psjpr.com
    X-MS-Has-Attach: yes
    X-MS-TNEF-Correlator:
    Content-Type: multipart/mixed;
     boundary="_002_9c2e5956bc9b49efbbc61a358f61698bexchange01psjprcom_"
    MIME-Version: 1.0
    --_002_9c2e5956bc9b49efbbc61a358f61698bexchange01psjprcom_
    Content-Type: text/plain; charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable
    The message you requested is attached.
    --_002_9c2e5956bc9b49efbbc61a358f61698bexchange01psjprcom_
    Content-Type: message/rfc822
    Subject:
    Thread-Index: Acib1zFexS+KMQAOSD+lcMut076Wyg==
    Accept-Language: en-US
    X-MS-Has-Attach:
    X-MS-TNEF-Correlator:
    Content-Type: text/plain; charset="us-ascii"
    Content-Transfer-Encoding: quoted-printable
    MIME-Version: 1.0
    --_002_9c2e5956bc9b49efbbc61a358f61698bexchange01psjprcom_--

    Did you ever this to work ?

  • Data is not Base64 encoded - error when starting Weblogic connecting to IS

    I get the following error trying to connect to Identity Server from weblogic 7.0 via the weblogic java policy agent from Sun:
    java.lang.ExceptionInInitializerError: java.lang.RuntimeException: Data is not Base64 encoded.
    I have set the encode cookie to true on both the policy agent side and the Identity Server side. I have also restarted both, but still receiving this error.
    Has anyone had similar problems? Any soluitions?

    Hello,
    I am getting the same error for a tomcat policy agent . Ihave installed Identity server on Solaris 9 and Tomcat 4.1.27 on the same machine. I set followinf property in policy agent's AMAgent.properties-
    com.iplanet.am.cookie.encode=true
    However, it doesn't help :-(
    what else is to be done? The documentation says that modify AMConfig.properties file on the client side for this property. Howveer, i do not have AMConfig fil on tomcat side. so i modified AMAgent.property.
    Is that ok?

  • Converting spool to pdf to base64

    Hello people
    I am trying to convert a spool to pdf and then I need to convert the pdf to base64.
    I used fm CONVERT_OTFSPOOLJOB_2_PDF to convert the spool to pdf, with the data returned in an internal table it_pdf of type tline.
    I then need to convert it_pdf to base64, I did it as follows:
    DATA: v_input       TYPE xstring,
              v_string64   TYPE string,
      EXPORT it_pdf[] TO DATA BUFFER v_input. "convert to xstring
      CALL FUNCTION 'SCMS_BASE64_ENCODE_STR'
        EXPORTING
          input  = v_input
        IMPORTING
          output = v_string64
    v_string64 seems to contain corrupt data, is this the correct way, anyone have any suggestions here?
    Thanx in advance.

    Just today someone has posted this link somewhere
    https://wiki.sdn.sap.com/wiki/display/sandbox/Conversion%20of%20Spool%20Request%20Data%20into%20PDF%20and%20Excel%20Format%20and%20Send%20it%20into%20Mail

  • Problem with base64 encoding an xml file with accented characters

    Oracle 10.2.0.1.0 Enterprise Edition running under windows 2003 server
    DB Characterset UTF-8
    I have a routine which takes an xml file and base64 encodes it, and the base64encoded text is stored in a clob column of a table.
    The xml file is stored in UTF-8 format.
    The routine works correctly, except when there are accented characters.
    I am using dbms_lob.loadclobfrom file to load the file.
    DBMS_LOB.OPEN(src_clob, DBMS_LOB.LOB_READONLY);
        DBMS_LOB.LoadCLOBFromFile(
              DEST_LOB     => dest_clob
            , SRC_BFILE    => src_clob
            , AMOUNT       => DBMS_LOB.GETLENGTH(src_clob)
            , DEST_OFFSET  => dst_offset
            , SRC_OFFSET   => src_offset
            , BFILE_CSID   =>dbms_lob.default_csid
            , LANG_CONTEXT => lang_ctx
            , WARNING      => warning
        DBMS_LOB.CLOSE(src_clob);base 64 encoded xml with accented character -- incorrect
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxncDpBcHBs
    aWNhdGlvblByb2ZpbGUgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAx
    L1hNTFNjaGVtYS1pbnN0YW5jZSINCiAgICB4c2k6c2NoZW1hTG9jYXRpb249Imh0
    dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1zLXByb2Zp
    bGVzLzEuMS4wIGh0dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9z
    eXN0ZW1zLXByb2ZpbGVzLzEuMS4wL0dQLnN5c3RlbXMucHJvZmlsZXMuMS4xLjAu
    QXBwbGljYXRpb25Qcm9maWxlLnhzZCINCiAgICB4bWxuczpncD0iaHR0cDovL25h
    bWVzcGFjZXMuZ2xvYmFscGxhdGZvcm0ub3JnL3N5c3RlbXMtcHJvZmlsZXMvMS4x
    LjAiDQogICAgVW5pcXVlSUQ9Ik1FIiBQcm9maWxlVmVyc2lvbj0iMS4xLjAiIEVy
    cmF0YVZlcnNpb249IjAiPg0KICAgIDxncDpEZXNjcmlwdGlvbj5Gb3J1bSBUZXN0
    PC9ncDpEZXNjcmlwdGlvbj4NCiAgICA8Z3A6RGF0YUVsZW1lbnQgTmFtZT0iw6Fj
    Y2VudCIgRXh0ZXJuYWw9InRydWUiIFR5cGU9IkJ5dGVTdHJpbmciIEVuY29kaW5n
    PSJIRVgiIEZpeGVkTGVuZ3RoPSJmYWxzZSIgTGVuZ3RoPSIxNiIgUmVhZFdyaXRl
    PSJ0cnVlIiBVcGRhdGU9InRydWUiIE9wdGlvbmFsPSJ0cnVlIiAvPiAgICANCjwv
    Z3A6QXBwbGljYXRpb25Qcm9maWxlPg0Kbase 64 encoded xml without accented character -- correct
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxncDpBcHBs
    aWNhdGlvblByb2ZpbGUgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAx
    L1hNTFNjaGVtYS1pbnN0YW5jZSINCiAgICB4c2k6c2NoZW1hTG9jYXRpb249Imh0
    dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1zLXByb2Zp
    bGVzLzEuMS4wIGh0dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9z
    eXN0ZW1zLXByb2ZpbGVzLzEuMS4wL0dQLnN5c3RlbXMucHJvZmlsZXMuMS4xLjAu
    QXBwbGljYXRpb25Qcm9maWxlLnhzZCINCiAgICB4bWxuczpncD0iaHR0cDovL25h
    bWVzcGFjZXMuZ2xvYmFscGxhdGZvcm0ub3JnL3N5c3RlbXMtcHJvZmlsZXMvMS4x
    LjAiDQogICAgVW5pcXVlSUQ9Ik1FIiBQcm9maWxlVmVyc2lvbj0iMS4xLjAiIEVy
    cmF0YVZlcnNpb249IjAiPg0KICAgIDxncDpEZXNjcmlwdGlvbj5Gb3J1bSBUZXN0
    PC9ncDpEZXNjcmlwdGlvbj4NCiAgICA8Z3A6RGF0YUVsZW1lbnQgTmFtZT0iYWNj
    ZW50IiBFeHRlcm5hbD0idHJ1ZSIgVHlwZT0iQnl0ZVN0cmluZyIgRW5jb2Rpbmc9
    IkhFWCIgRml4ZWRMZW5ndGg9ImZhbHNlIiBMZW5ndGg9IjE2IiBSZWFkV3JpdGU9
    InRydWUiIFVwZGF0ZT0idHJ1ZSIgT3B0aW9uYWw9InRydWUiIC8+ICAgIA0KPC9n
    cDpBcHBsaWNhdGlvblByb2ZpbGU+DQo=the xml file in use is
    <?xml version="1.0" encoding="UTF-8"?>
    <gp:ApplicationProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://namespaces.globalplatform.org/systems-profiles/1.1.0 http://namespaces.globalplatform.org/systems-profiles/1.1.0/GP.systems.profiles.1.1.0.ApplicationProfile.xsd"
        xmlns:gp="http://namespaces.globalplatform.org/systems-profiles/1.1.0"
        UniqueID="ME" ProfileVersion="1.1.0" ErrataVersion="0">
        <gp:Description>Forum Test</gp:Description>
        <gp:DataElement Name="áccent" External="true" Type="ByteString" Encoding="HEX" FixedLength="false" Length="16" ReadWrite="true" Update="true" Optional="true" />   
    </gp:ApplicationProfile>The file is being loaded from a windows xp professional 32 bit system.
    If I just convert the xml text of the file using
    select utl_raw.cast_to_varchar2(
    utl_encode.base64_encode(
    utl_raw.cast_to_raw(
    '<?xml version="1.0" encoding="UTF-8"?>
    <gp:ApplicationProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://namespaces.globalplatform.org/systems-profiles/1.1.0 http://namespaces.globalplatform.org/systems-profiles/1.1.0/GP.systems.profiles.1.1.0.ApplicationProfile.xsd"
        xmlns:gp="http://namespaces.globalplatform.org/systems-profiles/1.1.0"
        UniqueID="ME" ProfileVersion="1.1.0" ErrataVersion="0">
        <gp:Description>Forum Test</gp:Description>
        <gp:DataElement Name="áccent" External="true" Type="ByteString" Encoding="HEX" FixedLength="false" Length="16" ReadWrite="true" Update="true" Optional="true" />   
    </gp:applicationprofile>'
    ))) from dual;I get the following
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGdwOkFwcGxp
    Y2F0aW9uUHJvZmlsZSB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEv
    WE1MU2NoZW1hLWluc3RhbmNlIgogICAgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRw
    Oi8vbmFtZXNwYWNlcy5nbG9iYWxwbGF0Zm9ybS5vcmcvc3lzdGVtcy1wcm9maWxl
    cy8xLjEuMCBodHRwOi8vbmFtZXNwYWNlcy5nbG9iYWxwbGF0Zm9ybS5vcmcvc3lz
    dGVtcy1wcm9maWxlcy8xLjEuMC9HUC5zeXN0ZW1zLnByb2ZpbGVzLjEuMS4wLkFw
    cGxpY2F0aW9uUHJvZmlsZS54c2QiCiAgICB4bWxuczpncD0iaHR0cDovL25hbWVz
    cGFjZXMuZ2xvYmFscGxhdGZvcm0ub3JnL3N5c3RlbXMtcHJvZmlsZXMvMS4xLjAi
    CiAgICBVbmlxdWVJRD0iTUUiIFByb2ZpbGVWZXJzaW9uPSIxLjEuMCIgRXJyYXRh
    VmVyc2lvbj0iMCI+CiAgICA8Z3A6RGVzY3JpcHRpb24+Rm9ydW0gVGVzdDwvZ3A6
    RGVzY3JpcHRpb24+CiAgICA8Z3A6RGF0YUVsZW1lbnQgTmFtZT0iw6FjY2VudCIg
    RXh0ZXJuYWw9InRydWUiIFR5cGU9IkJ5dGVTdHJpbmciIEVuY29kaW5nPSJIRVgi
    IEZpeGVkTGVuZ3RoPSJmYWxzZSIgTGVuZ3RoPSIxNiIgUmVhZFdyaXRlPSJ0cnVl
    IiBVcGRhdGU9InRydWUiIE9wdGlvbmFsPSJ0cnVlIiAvPiAgICAKPC9ncDphcHBs
    aWNhdGlvbnByb2ZpbGU+Edited by: Keith Jamieson on Jul 13, 2012 9:59 AM
    added code tag for last base64 encoded object

    Not sure if utl_i18n is already there in version prior to 11.2.0.2.
    But on above mentioned version I can do the simplified method
    SQL> SELECT utl_i18n.raw_to_char (
             utl_encode.base64_encode (
               xmltype (
                 '<?xml version="1.0" encoding="UTF-8"?>
    <gp:ApplicationProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://namespaces.globalplatform.org/systems-profiles/1.1.0 http://namespaces.globalplatform.org/systems-profiles/1.1.0/GP.systems.profiles.1.1.0.ApplicationProfile.xsd"
        xmlns:gp="http://namespaces.globalplatform.org/systems-profiles/1.1.0"
        UniqueID="ME" ProfileVersion="1.1.0" ErrataVersion="0">
        <gp:Description>Forum Test</gp:Description>
        <gp:DataElement Name="áccent" External="true" Type="ByteString" Encoding="HEX" FixedLength="false" Length="16" ReadWrite="true" Update="true" Optional="true" />   
    </gp:ApplicationProfile>').getblobval (
                 NLS_CHARSET_ID ('utf8'))),
             'utf8')
             x
      FROM DUAL
    X                                                                                                                                                    
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGdwOkFwcGxp                                                                                     
    Y2F0aW9uUHJvZmlsZSB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEv                                                                                     
    WE1MU2NoZW1hLWluc3RhbmNlIiB4c2k6c2NoZW1hTG9jYXRpb249Imh0dHA6Ly9u                                                                                     
    YW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1zLXByb2ZpbGVzLzEu                                                                                     
    MS4wIGh0dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1z                                                                                     
    LXByb2ZpbGVzLzEuMS4wL0dQLnN5c3RlbXMucHJvZmlsZXMuMS4xLjAuQXBwbGlj                                                                                     
    YXRpb25Qcm9maWxlLnhzZCIgeG1sbnM6Z3A9Imh0dHA6Ly9uYW1lc3BhY2VzLmds                                                                                     
    b2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1zLXByb2ZpbGVzLzEuMS4wIiBVbmlxdWVJ                                                                                     
    RD0iTUUiIFByb2ZpbGVWZXJzaW9uPSIxLjEuMCIgRXJyYXRhVmVyc2lvbj0iMCI+                                                                                     
    CiAgPGdwOkRlc2NyaXB0aW9uPkZvcnVtIFRlc3Q8L2dwOkRlc2NyaXB0aW9uPgog                                                                                     
    IDxncDpEYXRhRWxlbWVudCBOYW1lPSLDoWNjZW50IiBFeHRlcm5hbD0idHJ1ZSIg                                                                                     
    VHlwZT0iQnl0ZVN0cmluZyIgRW5jb2Rpbmc9IkhFWCIgRml4ZWRMZW5ndGg9ImZh                                                                                     
    bHNlIiBMZW5ndGg9IjE2IiBSZWFkV3JpdGU9InRydWUiIFVwZGF0ZT0idHJ1ZSIg                                                                                     
    T3B0aW9uYWw9InRydWUiLz4KPC9ncDpBcHBsaWNhdGlvblByb2ZpbGU+Cg==                                                                                         
    1 row selected.which encodes and decodes properly on my system even with accented characters.

  • Problem with My Base64 Encoding CLOB  Routine.

    I have written a program which reads an xml file into the database
    and makes it Base64encoded.
    This needs to work on 10g and above
    If the read length specified in the code below is greater than the length of the xml_file, then I get the expected result(output).
    However if the read length is less than the length of the file, then I get a lot of '==' in the file and as a result, incorrect encoding which means that the file will not be readable through the application.
    I'm pretty sure I'm reading the blob lengths correctly, and the problem is somehow related to the base64 encoding.Any help appreciated
    [create or replace profile_dir as &profile_dir;
    create global temporary table load_xml
    (profile_text clob)
    on commit delete rows;
    create or replace
    procedure encode_xml_clobs(p_file_in  in varchar2,
                                 p_clob_out out nocopy clob )
    as
    pragma autonomous_transaction;
        dest_clob   CLOB;
        src_clob    BFILE  := BFILENAME('PROFILE_DIR', p_file_in);
        dst_offset  number := 1 ;
        src_offset  number := 1 ;
        lang_ctx    number := DBMS_LOB.DEFAULT_LANG_CTX;
        warning     number;
    -- processing declarations for encoding base64 --
    v_xml_string varchar2(32767);
    v_string varchar2(32767);
    v_start_pos number := 0;
    v_read_length number := 1000;
    v_final_start_pos number;
    v_clob_length number;
    type clob_array_type is table of clob index by binary_integer;
    clob_array clob_array_type;
    v_index number :=0;
    -- Declarations for converting base64encoded string to a clob
    v_encoded_length number;
    v_temp_clob clob;
    BEGIN
        -- THE FOLLOWING BLOCK OF CODE WILL ATTEMPT TO INSERT / WRITE THE CONTENTS
        -- OF AN XML FILE TO A CLOB COLUMN. IN THIS CASE, WE WILL USE THE NEW
        -- DBMS_LOB.LoadCLOBFromFile() API WHICH *DOES* SUPPORT MULTI-BYTE
        -- CHARACTER SET DATA.
    -- load_xml should be a  Global temporary table with on commit delete rows
        INSERT INTO load_xml(profile_text)
            VALUES( empty_clob())
            RETURNING profile_text INTO dest_clob;
        -- OPENING THE SOURCE BFILE IS MANDATORY
        DBMS_LOB.OPEN(src_clob, DBMS_LOB.LOB_READONLY);
        DBMS_LOB.LoadCLOBFromFile(
              DEST_LOB     => dest_clob
            , SRC_BFILE    => src_clob
            , AMOUNT       => DBMS_LOB.GETLENGTH(src_clob)
            , DEST_OFFSET  => dst_offset
            , SRC_OFFSET   => src_offset
            , BFILE_CSID   => DBMS_LOB.DEFAULT_CSID
            , LANG_CONTEXT => lang_ctx
            , WARNING      => warning
        DBMS_LOB.CLOSE(src_clob);
    --    DBMS_OUTPUT.PUT_LINE('Loaded XML File using DBMS_LOB.LoadCLOBFromFile: (ID=1');
    -- file now successfully loaded
    select dbms_lob.GETLENGTH(profile_text)
    into v_clob_length
    from load_xml;
    -- File now loaded in temporary table
    -- we now need to take the clob , convert it to varchar2
    v_read_length :=64;
    v_xml_string := '';
    while v_start_pos <=  v_clob_length
    loop
    v_index := v_index + 1;
    v_string := '';
    --dbms_output.put_line('Start_pos=>'||(v_start_pos+1)||' Read Length=>'||v_read_length);
    --encode base64
    select utl_raw.cast_to_varchar2(
    utl_encode.base64_encode(
    utl_raw.cast_to_raw(dbms_lob.substr(profile_text,least(v_read_length,v_clob_length-v_start_pos),v_start_pos+1))
      into v_string
      from load_xml;
    --dbms_output.put_line(v_string);
    v_start_pos  := v_start_pos+v_read_length;
    clob_array(v_index) := v_string;
    end loop;
    p_clob_out := clob_array(1);
    for i in 2 .. v_index
    loop
    dbms_lob.append(p_clob_out,clob_array(i));
    end loop;
    commit;
    END;

    Base64 encoding encodes every 3 bytes of input data into 4 bytes of output data. It uses equal signs to indicate nodata and only at the end of the encoded sequence. Try chaning your v_read_length parameter to a multiple of 3 e.g. 960 or 1008 instead of the current 1000. I'm using multiples of 48 because the utl_encode.base64_encode function adds a linebreak for every 48 bytes of input data (64 bytes of output). If you use a value that's not divisible by 48 you will still get a legitimate encoding as long as it's divisible by 3, but you will get some lines longer than others when you append them together.

  • Since Firefox 4, I can get a background image to work using base64 encoded, but not a local file, this worked in Firefox 3, how do I resolve this.

    Using either of the 4 examples shown below, to have a background image display inside about:blank worked in Firefox 3.x (using Stylish add-on), however since Firefox 4, only using the base64 encoded version of images works. Is there any way to fix this so I don't have to encode every image I wish to use? Encoding the image makes the stylish file absolutely huge, & a real pain to keep encoding whenever I want to change the image.
    body:empty { background: url("resource:/res/images/OnFire.jpg")
    body { background-image: url("resource:/res/images/OnFire.jpg")
    body:empty { background:url("data:
    body { background-image: url("data:
    I've also previously disabled most of the add-ons, except for Status-4-Evar, Stylish, & Firebug, in an attempt to see if something else was interfering, but no change.
    I can supply a copy of the previously working (FF 3.x) code to some of the about:blank styles if needed for testing purposes.

    Type '''about:addons'''<enter> in the address bar to open the '''Add-ons Manager.'''
    Hot key; '''<Control>''(Mac:<Command>)'' <Shift> A)'''
    On the left side of the page, select '''Plugins.'''
    Is it listed here? Select '''Disable.'''

  • Base64 encoded attachments misunderstood by recipients

    My boss uses Mail.app, and a number of people have reported that they can never open her attachments. When I look at the files they receive from her, they appear to be base64 encoded, and indeed decoding them makes them perfectly readable. Unfortunately, I don't think any of the built-in apps in OS X can do this decoding. Also, not all of the recipients use Macs.
    At first I thought that the issue might be that she was not using the 'Windows friendly attachments'. However, I tried sending a message from another coworker's computer without selecting that option, and it worked fine. I then discovered that the problem is that if she drags her attachments into the message rather than selecting them via 'add attachment', they don't work. Basically, if the attachment is inline rather than at the end of the message.
    I still thought that using 'Windows friendly attachments' would fix the problem, so on another Mac I tried setting Mail.app to always send Windows Friendly attachments (To do this, just open Mail.app, make sure you aren't composing an e-mail, and then under Edit > Attachments, select 'Always send Windows Friendly attachments'). However, this didn't work, either.
    So, I think that the solution is just to tell her either to use the 'Add Attachment' button or to drag the file to the end of the message.
    It's a shame that inline attachments don't work for so many e-mail clients (notably Gmail). I don't think that this is an Apple innovation... is it?
    I hope that helps someone,
    Greg

    Did you ever this to work ?

  • Base64 Encoding in SOA 11.1.1.5.0

    Hi All,
    For writing a String to a Flat File(Opaque Schema) using FileAdapter the string needs to be converted to Base64 Encoding
    I am not able to Encode the string to base64 in BPEL 11g.
    JDEVELOPER VERSION.Studio Edition Version 11.1.1.5.0
    SOA Suite Version 11.1.1.5.0
    I tried with BPEL1.1 specification and BPEL2.0 specification with no luck
    Steps carried out
    a) Created a variable "input1" with String type
    b) Assigned a custom message to input1 variable
    c) In Java Embedding activity wrote the below snippet
    String input = (String)getVariableData("input1");
    addAuditTrailEntry(input);
    String encodeData = oracle.soa.common.util.Base64Encoder.encode(input);
    addAuditTrailEntry(encodeData);
    I am getting different errors while using BPEL 1.1 spec and 2.0 spec
    BPEL 1.1 Spec
    Jdeveloper doesnt compile.
    Error is Error: SCAC-50012
    BPEL 2.0 Spec
    Jdeveloper compile's but while deploying am getting the below error
    Error deploying BPEL suitcase.
    error while attempting to deploy the BPEL component file "/dtrb5o/admin/soa_domain/mserver/soa_domain/servers/soa_server1/dc/soa_04c5e5c5-eeb1-49da-841a-c793206a0285";
    the exception reported is:java.lang.RuntimeException: failed to compile execlets of BPELProcess1
    This error contained an exception thrown by the underlying deployment module.
    Verify the exception trace in the log (with logging level set to debug mode).
    +[05:40:21 PM] Check server log for more details.+
    +[05:40:21 PM] Error deploying archive sca_Base64_2_rev1.0.jar to partition "default" on server soa_server1 [] +
    +[05:40:21 PM] #### Deployment incomplete. ####+
    +[05:40:21 PM] Error deploying archive file:/C:/JdevHome/Users/c_anishi/mywork/BPELApplication/Base64_2/deploy/sca_Base64_2_rev1.0.jar +
    +(oracle.tip.tools.ide.fabric.deploy.common.SOARemoteDeployer)+
    The SOA RunTime Library is already added to the project. I even tried explicitly adding fabric-common.jar and fabric-runtime.jar to the project library with no luck
    Please let me know if any one has acheived the base64 encoding in 11.1.1.5.0

    Check this out,
    http://yatanveersingh.blogspot.com/2011/08/how-to-call-java-method-inside-bpel.html
    -Yatan

  • Base64 encoding in SOAP adapter

    Hi,
    Is it possible to transform outgoing messages to Base64 encoding format in XI using module processors and security encryption? I'm using receiver SOAP adapter (without SOAP header) and using PayloadZipBean module processor to zip the outgoing message. Also I need to add digital signature and base64 encryption to the zipped message. Please let me know how this can be achieved.
    Thanks,
    Dipankar

    hi dipankar
    check the below blog
    How to use Digital Certificates for Signing & Encrypting Messages in XI                         
    How to use Digital Certificates for Signing & Encrypting Messages in XI     
    hope this resolves your issue
    additionally check this
    How to use Client Authentication with SOAP Adapter                              
    How to use Client Authentication with SOAP Adapter     
    also
    How XML Encryption can be done using web services security in SAP NetWeaver XI                                        
    How XML Encryption can be done using web services security in SAP NetWeaver XI                                        
    reward points if helpfull
    regards
    kummari
    Edited by: kummari on Jul 19, 2008 7:24 AM

  • Get canvas.toDataURL('image/jpeg') and convert base64 encoding to java.sql.Blob

    Convert canvas.toDataURL('image/jpeg') to java.sql.Blob.
    I am using oracle adf so I am able to action a backing bean from javascript and pass in parameters as a map. I pass in the canvas.toDataURL('image/jpeg') which I then try to decode in my bean. Using BASE64Decoder and the converting the bytearray to a file I can see the image is corrupted as I can't open the file thus converting the bytearray to blob is also a waste.
    Has anyone any ideas on base64 encoding from canvas.toDataURL to file or Blob?

    Use Case:
    A jsf page that enables a user to take photos using the HTML5 canvas feature - interact with webcam -, take photos and upload to profile
    1. I have created the jsf page with the javascript below; this pops up as a dialog and works okay and onclick an upload image, triggers the snapImage javascript function below and sends the imgURL parameter to the serverside managedbean
    <!-- java script-->
    function snapImage(event){
                    var canvas = AdfPage.PAGE.findComponent('canvas');
                    AdfCustomEvent.queue(event.getSource(),"getCamImage",{imgURL:canvas.toDataURL('image/jpeg'),true);
                    event.cancel();
    <!-- bean -->
    public void getCamImage(ClientEvent ce){
    String url=(String)ce.getAttributes().get("imgURL");
    decodeBase64URLToBlob(url);
    private BlobDomain decodeBaseB4URLToBlob(String url64){
                    BASE64Decoder de=new BASE64Decoder();
                    byte[] bytes=de.decode(url64);
                    File file=new File("abc.jpg");
                    InputStream in = new ByteArrayInputStream(bytes);
                    BufferedImage bImageFromConvert = ImageIO.read(in);
                    in.close();
                    ImageIO.write(bImageFromConvert, "jpg", file);
                    return createBlobDomainFromFile(file);
    ----problem---
    Accessing the generated jpeg file shows the image is corrupted, probably missing bytes or encode/decoder issues.and the blob image after uploading to database is saved as a binary stream which ondownload doesnt render as an image or anything i know of.
    Is there anyways of achieving the conversion without errors?

  • Support on 'Base64 encoding in XML gateway Web service SOAP content'

    Hi Experts,
    IHAC who's requirement is as follows:
    They are currently using Web service protocol to send order information from Oracle Applications to their trading partner.
    But need to encode the payload in base64 encoding in the SOAP request.
    Further details:
    =====================================================================
    Current SOAP request is,
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bac="http://backend.ws.gtas.gridnode.com">
    <soapenv:Header/>
    <soapenv:Body>
    <bac:backendImport4>
    <bac:username>?</bac:username>
    <bac:password>?</bac:password>
    <bac:recipient>?</bac:recipient>
    <bac:contentFileName>?</bac:contentFileName>
    <bac:content>
    <EMPLOYEE>
    <EMPLOYEE_DATA>
    <EMAIL_ADDRESS/>
    <EMPLOYEE_ID>81</EMPLOYEE_ID>
    <EMPLOYEE_NUM>2</EMPLOYEE_NUM>
    <FIRST_NAME/>
    <FULL_NAME>Eddi.S,</FULL_NAME>
    <LAST_NAME>Eddi.S</LAST_NAME>
    <MIDDLE_NAME/>
    </EMPLOYEE_DATA>
    </EMPLOYEE>
    </bac:content>
    <bac:docType>?</bac:docType>
    </bac:backendImport4>
    </soapenv:Body>
    </soapenv:Envelope>
    Required SOAP request with base64 encoding is:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bac="http://backend.ws.gtas.gridnode.com">
    <soapenv:Header/>
    <soapenv:Body>
    <bac:backendImport4>
    <bac:username>?</bac:username>
    <bac:password>?</bac:password>
    <bac:recipient>?</bac:recipient>
    <bac:contentFileName>?</bac:contentFileName>
    <bac:content>
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9J25vJz8+DQo8IURPQ1RZUEUgRU1QTE9ZRUU+DQo8IS0tIE9yYWNsZSBlWHRlbnNpYmxlIE1hcmt1cCBMYW5ndWFnZSBHYXRld2F5IFNlcnZlciAgLS0+DQo8RU1QTE9ZRUU+DQogIDxFTVBMT1lFRV9EQVRBPg0KICAgIDxFTUFJTF9BRERSRVNTLz4NCiAgICA8RU1QTE9ZRUVfSUQ+ODE8L0VNUExPWUVFX0lEPg0KICAgIDxFTVBMT1lFRV9OVU0+MjwvRU1QTE9ZRUVfTlVNPg0KICAgIDxGSVJTVF9OQU1FLz4NCiAgICA8RlVMTF9OQU1FPkVkZGkuUyw8L0ZVTExfTkFNRT4NCiAgICA8TEFTVF9OQU1FPkVkZGkuUzwvTEFTVF9OQU1FPg0KICAgIDxNSURETEVfTkFNRS8+DQogIDwvRU1QTE9ZRUVfREFUQT4NCjwvRU1QTE9ZRUU+DQo=
    </bac:content>
    <bac:docType>?</bac:docType>
    </bac:backendImport4>
    </soapenv:Body>
    </soapenv:Envelope>
    The issue in question is the content within the element <bac:content>.
    Base64 encoding of the payload
    <EMPLOYEE>
    <EMPLOYEE_DATA>
    <EMAIL_ADDRESS/>
    <EMPLOYEE_ID>81</EMPLOYEE_ID>
    <EMPLOYEE_NUM>2</EMPLOYEE_NUM>
    <FIRST_NAME/>
    <FULL_NAME>Eddi.S,</FULL_NAME>
    <LAST_NAME>Eddi.S</LAST_NAME>
    <MIDDLE_NAME/>
    </EMPLOYEE_DATA>
    </EMPLOYEE>
    is
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9J25vJz8+DQo8IURPQ1RZUEUgRU1QTE9ZRUU+DQo8IS0tIE9yYWNsZSBlWHRlbnNpYmxlIE1hcmt1cCBMYW5ndWFnZSBHYXRld2F5IFNlcnZlciAgLS0+DQo8RU1QTE9ZRUU+DQogIDxFTVBMT1lFRV9EQVRBPg0KICAgIDxFTUFJTF9BRERSRVNTLz4NCiAgICA8RU1QTE9ZRUVfSUQ+ODE8L0VNUExPWUVFX0lEPg0KICAgIDxFTVBMT1lFRV9OVU0+MjwvRU1QTE9ZRUVfTlVNPg0KICAgIDxGSVJTVF9OQU1FLz4NCiAgICA8RlVMTF9OQU1FPkVkZGkuUyw8L0ZVTExfTkFNRT4NCiAgICA8TEFTVF9OQU1FPkVkZGkuUzwvTEFTVF9OQU1FPg0KICAgIDxNSURETEVfTkFNRS8+DQogIDwvRU1QTE9ZRUVfREFUQT4NCjwvRU1QTE9ZRUU+DQo=
    ========================================================================
    Is there a way in XML gateway to encode the payload automatically to base64 encoding so that it can accommodate the unicode
    Is there any way to encode the order information from EBS tables to base64 format in the outbound SOAP request ? Is this supported . If yes, how.?
    Does this involve customization. Is it possible to use encoder/decoder provided in sites such as XSL on top of XML : http://gandhimukul.tripod.com/xslt/base64-xslt.html
    Basically, They are trying to use XML Gateway to send and receive messages to a Trading Partner via SOAP. The issues is
    1. Outbound: The TP web service can only receive xml content that is encoded in base 64 binary format. How do we configure to encode content using base64
    2. Inbound: They want to receive messages using the SOAP architecture into XML gateway.
    Please let us know if you have any detailed configuration document for this purpose. Please advise and share relevant details.
    regards,
    Ajith

    Hi Gurvinder,
    Thanks for looking into this. Just to clarify again.
    example XML content:
    <?xml version="1.0" encoding="UTF-8" standalone='no'?>
    <!DOCTYPE EMPLOYEE>
    <!-- Oracle eXtensible Markup Language Gateway Server -->
    <EMPLOYEE>
    <EMPLOYEE_DATA>
    <EMAIL_ADDRESS/>
    <EMPLOYEE_ID>81</EMPLOYEE_ID>
    <EMPLOYEE_NUM>2</EMPLOYEE_NUM>
    <FIRST_NAME/>
    <FULL_NAME>Eddi.S,</FULL_NAME>
    <LAST_NAME>Eddi.S</LAST_NAME>
    <MIDDLE_NAME/>
    </EMPLOYEE_DATA>
    </EMPLOYEE>
    Sample Soap message that needs to be sent to our service provider is as follows
    <?xml version="1.0" encoding="UTF-8" ?>
    - <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
    - <soapenv:Body>
    - <ns5:backendImport5 xmlns:ns5="http://backend.ws.gtas.gridnode.com">
    <ns5:username>admin</ns5:username>
    <ns5:password>admin1</ns5:password>
    <ns5:recipient>GT424</ns5:recipient>
    <ns5:contentFileName>cabotTest.xml</ns5:contentFileName>
    <ns5:content>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9J25vJz8+DQo8IURPQ1RZUEUgRU1QTE9ZRUU+DQo8IS0tIE9yYWNsZSBlWHRlbnNpYmxlIE1hcmt1cCBMYW5ndWFnZSBHYXRld2F5IFNlcnZlciAgLS0+DQo8RU1QTE9ZRUU+DQogIDxFTVBMT1lFRV9EQVRBPg0KICAgIDxFTUFJTF9BRERSRVNTLz4NCiAgICA8RU1QTE9ZRUVfSUQ+ODE8L0VNUExPWUVFX0lEPg0KICAgIDxFTVBMT1lFRV9OVU0+MjwvRU1QTE9ZRUVfTlVNPg0KICAgIDxGSVJTVF9OQU1FLz4NCiAgICA8RlVMTF9OQU1FPkVkZGkuUyw8L0ZVTExfTkFNRT4NCiAgICA8TEFTVF9OQU1FPkVkZGkuUzwvTEFTVF9OQU1FPg0KICAgIDxNSURETEVfTkFNRS8+DQogIDwvRU1QTE9ZRUVfREFUQT4NCjwvRU1QTE9ZRUU+DQo=</ns5:content>
    <ns5:docType>3C3RN</ns5:docType>
    </ns5:backendImport5>
    </soapenv:Body>
    </soapenv:Envelope>
    . The xml content provided need to be encoded as base 64 encoding. The following is the equivalent of above xml content.
    <ns5:content>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9J25vJz8+DQo8IURPQ1RZUEUgRU1QTE9ZRUU+DQo8IS0tIE9yYWNsZSBlWHRlbnNpYmxlIE1hcmt1cCBMYW5ndWFnZSBHYXRld2F5IFNlcnZlciAgLS0+DQo8RU1QTE9ZRUU+DQogIDxFTVBMT1lFRV9EQVRBPg0KICAgIDxFTUFJTF9BRERSRVNTLz4NCiAgICA8RU1QTE9ZRUVfSUQ+ODE8L0VNUExPWUVFX0lEPg0KICAgIDxFTVBMT1lFRV9OVU0+MjwvRU1QTE9ZRUVfTlVNPg0KICAgIDxGSVJTVF9OQU1FLz4NCiAgICA8RlVMTF9OQU1FPkVkZGkuUyw8L0ZVTExfTkFNRT4NCiAgICA8TEFTVF9OQU1FPkVkZGkuUzwvTEFTVF9OQU1FPg0KICAgIDxNSURETEVfTkFNRS8+DQogIDwvRU1QTE9ZRUVfREFUQT4NCjwvRU1QTE9ZRUU+DQo=</ns5:content>
    See that the content is encoded using the base64 format.
    Please help us to know how we can configure XML gateway to achieve this.
    Regards,
    Ajith

  • Error send a smartform PDF by Email to Vendor

    Hi Expert,
    Please help me.........................
    I want to send a PO (Smartform) as Email to Vendor.
    In SAPScript the PO send by Email is working fine, but in Smartforms it is not working.
    Normally, I will use via Smartforms the Program = YBAA_FM06P, FORM routine = ENTRY_NEU, PDF/Smartform Form = ZYBAA_MMPO1.
    A communication strategy has communication type as INT has been defined.
    This communication strategy has been set as default in the output type ZNEU. The transmission medium has been set to 5 (External Send) and the partner function as VN (Vendor).
    The e-mail address of the vendor has also been maintained.
    In transaction MN04, i have also made an entry for output type ZNEU and set the document type as NB.
    But message output do not create.
    How to send a smartform PDF by Email to vendor?
    Thanks,

    Hi,
    I can convert the PO output in to PDF from SOST I can sent it to external vendor using the Mail triggering configuration settings but meassage output do not create.
    Please tell me how can I do.
    Thank,

  • EEM ::base64::encode unknown to the router...

    An error occurs on an XR device :
    invalid command name "::base64::encode"
        while executing
    "::base64::encode [read $fd]"
    It seems that b64 encoding is not properly declare by default.
    How could I fix that ?

    I don't have access to IOS-XR at the moment with which to test, but I'm not sure the same EEM libraries exist in XR that exist in IOS.  However, there's nothing to keep you from adding them.  At the very least, you can take the tmpsys:/lib/tcl/base64.tcl file from an IOS device, and paste that into your EEM script.  You can also use the EEM user library directory on XR.  Create a directory on the device to hold your library files (e.g. disk0:/lib).  Copy the base64.tcl file to this directory, then configure:
    event manager directory user library disk0:/lib
    Then you can use the ::base64 namespace in your script.

Maybe you are looking for

  • Unable to open Database Home Page after installation

    Hello! I have made my very first installation of Oracle 10g XE and I have immediately tried to open the Database Home Page, as suggested by the installer. However, I have got a browser error and I noticed that no process was listening on port 8080. N

  • StarOffice 8 - finding all different font types in a Writer file

    Hello, I am currently using StarOffice 8 on a Windows XP system. I frequently transfer a large Writer (.odt) file between different computer systems as I constantly update the file with new information. As part of the updates, I use different fonts.

  • Panel size inconsistency

    Hi all. I am fairly new to making my panels native doc-able panels using Eclipse with Extension Builder. Up till now, I have been creating floating panels just using ScriptUI. I am pretty happy with the new process, and its good forcing me to brush u

  • Dreamweaver 8 Bugs in Windows Vista

    Thought i would start this thread because i am having mucho problemes with DW8 in Windows Vista Business Edition. I also know that at this time DW8 is not supported in Vista, hope this helps the developers: Crashes intermittently when embedding Flash

  • What is the significance of CONFIDENTIALcheck box in CONTRACT or GOA

    hello all in SRM header -> basic data ->CONFIDENTIAL who knows the secret of CONFIDENTIAL check box in SRM ? How indeed help the business in the real time. when buyers check this flag? thanks Muthu