Base64 binary encode a BLOB

I need to base64 binary encode a BLOB of up to 60k.
Basically I need a way to base64 binary encode a BLOB and output it to a text file.
I don't want to use UTL_ENCODE.BASE64_ENCODE(r raw) because breaking my BLOB into RAW size chunks, encoding each chunk and putting the encoded data back together again doesn't work, even if I strip the '=' character(s) off the end of all but the last chunk (they're there because of the way the data at the end of the encoded chunk falls for the bit count).
Basically I need a way to base64 binary encode a BLOB and output it to a text file.
The resultant encoded data will often exceed 32,000 characters.
Thanks in advance.
John

This may require a bit of tweaking for use as a Java stored procedure...
public class Base64Encoder {
/** Constructor
public Base64Encoder() {
public static String base64Encode(String s) {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
Base64OutputStream out = new Base64OutputStream(bOut);
try {
out.write(s.getBytes());
out.flush();
} catch (IOException ioe) {
//Something to do if ioe occurs
return bOut.toString();
/* BASE64 encoding encodes 3 bytes into 4 characters.
|11111122|22223333|33444444|
Each set of 6 bits is encoded according to the
toBase64 map. If the number of input bytes is not
a multiple of 3, then the last group of 4 characters
is padded with one or two = signs. Each output line
is at most 76 characters.
class Base64OutputStream extends FilterOutputStream
{  public Base64OutputStream(OutputStream out)
{  super(out);
public void write(int c) throws IOException
{  inbuf[i] = c;
i++;
if (i == 3)
{  super.write(toBase64[(inbuf[0] & 0xFC) >> 2]);
super.write(toBase64[((inbuf[0] & 0x03) << 4) |
((inbuf[1] & 0xF0) >> 4)]);
super.write(toBase64[((inbuf[1] & 0x0F) << 2) |
((inbuf[2] & 0xC0) >> 6)]);
super.write(toBase64[inbuf[2] & 0x3F]);
col += 4;
i = 0;
if (col >= 76)
{  super.write('\n');
col = 0;
public void flush() throws IOException
{  if (i == 1)
{  super.write(toBase64[(inbuf[0] & 0xFC) >> 2]);
super.write(toBase64[(inbuf[0] & 0x03) << 4]);
super.write('=');
super.write('=');
else if (i == 2)
{  super.write(toBase64[(inbuf[0] & 0xFC) >> 2]);
super.write(toBase64[((inbuf[0] & 0x03) << 4) |
((inbuf[1] & 0xF0) >> 4)]);
super.write(toBase64[(inbuf[1] & 0x0F) << 2]);
super.write('=');
private static char[] toBase64 =
{  'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '+', '/'
private int col = 0;
private int i = 0;
private int[] inbuf = new int[3];
}

Similar Messages

  • Base64 binary encode a .JPG

    I need to take a .JPG that is stored in a table as a <BLOB> and base64 binary encode it.
    The reason for doing this is so that I can include it as a single string of text in an XML file.
    And I have no idea how to do it!!!
    Help me please.
    Thanks in advance,
    John

    Thank you very much for your reply, but this function takes a Raw as its argument, whereas I have a BLOB.
    I'll look into breaking the BLOB down into sections, converting it to a Raw and encoding each section one at a time, but I'd prefer to encode the BLOB all in one go, if that is possible.
    Any ideas or other pointers?
    Cheers,
    John

  • Detecting character encoding from BLOB stream... (PLSQL)

    I'am looking for a procedure/function which can return me the character encoding of a "text/xml/csv/slk" file stored in BLOB..
    For example...
    I have 4 files in different encodings (UTF8, Utf8BOM, ISO8859_2, Windows1252)...
    With java I'can simply detect the character encoding with JuniversalCharDet (http://code.google.com/p/juniversalchardet/)...
    thank you

    Solved...
    On my local PC I have installed Java 1.5.0_00 (because on DB is 1.5.0_10)...
    With Jdeveloper I have recompiled source code from:
    http://juniversalchardet.googlecode.com/svn/trunk/src/org/mozilla/universalchardet
    http://code.google.com/p/juniversalchardet/
    After that I have made a JAR file and uploaded it with loadjava to my database...
    C:\>loadjava -grant r_inis_prod -force -schema insurance2 -verbose -thin -user username/password@ip:port:sid chardet.jarAfter that I have done a java procedure and PLSQL wrapper example below:
       public static String verifyEncoding(BLOB p_blob) {
           if (p_blob == null) return "-1";
           try
            InputStream is = new BufferedInputStream(p_blob.getBinaryStream());
            UniversalDetector detector = new UniversalDetector(null);
            byte[] buf = new byte[p_blob.getChunkSize()];
            int nread;
            while ((nread = is.read(buf)) > 0 && !detector.isDone()) {
                detector.handleData(buf, 0, nread);
            detector.dataEnd();
            is.close();
           return detector.getDetectedCharset();
           catch(Exception ex) {
               return "-2";
       }as you can see I used -2 for exception and -1 if input blob is null.
    then i have made a PLSQL procedure:
    function f_preveri_encoding(p_blob in blob) return varchar2 is
    language Java name 'Zip.Zip.verifyEncoding(oracle.sql.BLOB) return java.lang.String';After that I have uploaded 2 different txt files in my blob field.. (first one is encoded with UTF-8, second one with WINDOWS-1252)..
    example how to call:
    declare
       l_blob blob;
       l_encoding varchar2(100);
    begin
    select vsebina into l_blob from dok_vsebina_dokumenta_blob where id = 401587359 ;
    l_encoding := zip_util.f_preveri_encoding(l_blob);
    if l_encoding = 'UTF-8' then
       dbms_output.put_line('file is encoded with UTF-8');
    elsif l_encoding = 'WINDOWS-1252' then
       dbms_output.put_line('file is encoded with WINDOWS-1252');
    else
        dbms_output.put_line('other enc...');
    end if;
    end;Now I can get encoding from blob and convert it to database encoding and store datas in CLOB field..
    Here you have a chardet.jar file if you need this functionality..
    https://docs.google.com/open?id=0B6Z9wNTXyUEeVEk3VGh2cDRYTzg
    Edited by: peterv6i.blogspot.com on Nov 29, 2012 1:34 PM
    Edited by: peterv6i.blogspot.com on Nov 29, 2012 1:34 PM
    Edited by: peterv6i.blogspot.com on Nov 29, 2012 1:38 PM

  • Binary encoding

    Hi , I am writing an ascii file, how can i binary encode it.
    Thanks.

    Not sure if this is what you are looking for; but this is how I usually create real ascii files. (J2SDK 1.4)
    - Chris
    import java.io.*;
    import java.nio.charset.*;
    import java.nio.*;
    public class Main
      public static void main(String[] args)
        CharsetEncoder asciiEncoder = Charset.forName("US-ASCII").newEncoder();
        String messageToWrite = "Hello World\r\n";
        try
          FileOutputStream os = new FileOutputStream("c:/test.txt");
          os.write(
              asciiEncoder.encode(CharBuffer.wrap(messageToWrite)).array()
          os.close();
        catch (IOException ex)
          ex.printStackTrace();

  • BASE64 (PDF) CLOB to BLOB

    Hello everybody! I have to convert a BASE64 representation of a PDF file to BLOB. I found one example on the Internet but there is something wrong with it and I can't figure it out.
    create or replace function decode_base64(p_clob_in in clob) return blob is
    v_blob           blob;
    v_offset         integer;
    v_buffer_varchar varchar2(32000);
    v_buffer_raw     raw(32000);
    v_buffer_size    binary_integer := 32000;
    begin
    if p_clob_in is null then
    return null;
    end if;
    dbms_lob.CREATETEMPORARY(v_blob, true);
    v_offset := 1;
    FOR i IN 1..CEIL(dbms_lob.GETLENGTH(p_clob_in) / v_buffer_size)
    loop
    dbms_lob.READ(p_clob_in, v_buffer_size, v_offset, v_buffer_varchar);
    v_buffer_raw := utl_encode.BASE64_DECODE(utl_raw.CAST_TO_RAW(v_buffer_varchar));*
    dbms_lob.WRITEAPPEND(v_blob, utl_raw.LENGTH(v_buffer_raw), v_buffer_raw);
    v_offset := v_offset v_buffer_size;+
    end loop;
    return v_blob;
    end decode_base64;
    The above procedure should work with files of any size (since there is a loop), but it only works when the PDF is smaller than 32 KB.

    Just a guess.
    You may have additional CRLFs added when encoding.
    Try this:
    create or replace function replaceClob (opCLob CLOB,cpReplaceStr VARCHAR2,cpReplaceWith VARCHAR2) RETURN CLOB IS
       cBuffer    VARCHAR2 (32767);
       nBuffer    BINARY_INTEGER := 32767;
       nStart     PLS_INTEGER := 1;
       nLen            PLS_INTEGER;
       oCRtn      CLOB := EMPTY_CLOB;
       BEGIN
         DBMS_LOB.CreateTemporary(oCRtn,TRUE);
         nLen := DBMS_LOB.GetLength(opCLob);
         WHILE nStart < nLen
         LOOP
           DBMS_LOB.Read(opCLob, nBuffer, nStart, cBuffer);
           IF cBuffer IS NOT NULL THEN
             cBuffer := REPLACE(cBuffer, cpReplaceStr, cpReplaceWith);
             DBMS_LOB.WriteAppend(oCRtn, LENGTH(cBuffer), cBuffer);
           END IF;
           nStart := nStart + nBuffer;
         END LOOP;
         RETURN oCRtn;
       END;and then add to your code:
    create or replace function decode_base64(p_clob_in in clob) return blob is
           v_blob blob;
           v_offset integer;
           v_tem_clob clob;
           v_buffer_varchar varchar2(32000);
           v_buffer_raw raw(32000);
           v_buffer_size binary_integer := 32000;
           --v_buffer_size binary_integer := 3*1024;      
           begin
           if p_clob_in is null then
              return null;
           end if;
           -- Add this line
           v_tem_clob := replaceClob(p_clob_in,UTL_TCP.CRLF,'');
           dbms_lob.CREATETEMPORARY(v_blob, true);
           v_offset := 1;
           FOR i IN 1..CEIL(dbms_lob.GETLENGTH(v_tem_clob) / v_buffer_size) loop
               dbms_lob.READ(v_tem_clob, v_buffer_size, v_offset, v_buffer_varchar);          
               v_buffer_raw := utl_encode.BASE64_DECODE(utl_raw.CAST_TO_RAW(v_buffer_varchar));
               dbms_lob.WRITEAPPEND(v_blob, utl_raw.LENGTH(v_buffer_raw), v_buffer_raw);
               v_offset := v_offset + v_buffer_size;
           end loop;
           return v_blob;
    end decode_base64;Not tested.
    HTH
    Thomas

  • Parsing a UTF-8 encoded XML Blob object

    Hi,
    I am having a really strange problem, I am fetching a database BLOB object containing the XMLs and then parsing the XMLs. The XMLs are having some UTF-8 Encoded characters and when I am reading the XML from the BLOB, these characters lose their encoding, I had tried doing several things, but there is no means I am able to retain their UTF encoding. The characters causing real problem are mainly double qoutes, inverted commas, and apostrophe. I am attaching the piece of code below and you can see certain things I had ended up doing. What else can I try, I am using JAXP parser but I dont think that changing the parser may help because, here I am storing the XML file as I get from the database and on the very first stage it gets corrupted and I have to retain the UTF encoding. I tried to get the encoding info from the xml and it tells me cp1252 encoding, where did this come into picture and I couldn't try it retaining back to UTF -8
    Here in the temp.xml itself gets corrupted. I had spend some 3 days on this issue. Help needed!!!
    ResultSet rs = null;
        Statement stmt = null;
        Connection connection = null;
        InputStream inputStream = null;
        long cifElementId = -1;
        //Blob xmlData = null;
        BLOB xmlData=null;
        String xmlText = null;
        RubricBean rubricBean = null;
        ArrayList arrayBean = new ArrayList();
          rs = stmt.executeQuery(strQuery);
         // Iterate till result set has data
          while (rs.next()) {
            rubricBean = new RubricBean();
            cifElementId = rs.getLong("CIF_ELEMENT_ID");
                    // get xml data which is in Blob format
            xmlData = (oracle.sql.BLOB)rs.getBlob("XML");
            // Read Input stream from blob data
             inputStream =(InputStream)xmlData.getBinaryStream(); 
            // Reading the inputstream of data into an array of bytes.
            byte[] bytes = new byte[(int)xmlData.length()];
             inputStream.read(bytes);  
           // Get the String object from byte array
             xmlText = new String(bytes);
           // xmlText=new String(szTemp.getBytes("UTF-8"));
            //xmlText = convertToUTF(xmlText);
            File file = new File("C:\\temp.xml");
            file.createNewFile();
            // Write to temp file
            java.io.BufferedWriter out = new java.io.BufferedWriter(new java.io.FileWriter(file));
            out.write(xmlText);
            out.close();

    What the code you posted is doing:
    // Read Input stream from blob data
    inputStream =(InputStream)xmlData.getBinaryStream();Here you have a stream containing binary octets which encode some text in UTF-8.
    // Reading the inputstream of data into an
    into an array of bytes.
    byte[] bytes = new byte[(int)xmlData.length()];
    inputStream.read(bytes);Here you are reading between zero and xmlData.length() octets into a byte array. read(bytes[]) returns the number of bytes read, which may be less than the size of the array, and you don't check it.
    xmlText = new String(bytes);Here you are creating a string with the data in the byte array, using the platform's default character encoding.
    Since you mention cp1252, I'm guessing your platform is windows
    // xmlText=new new String(szTemp.getBytes("UTF-8"));I don't know what szTemp is, but xmlText = new String(bytes, "UTF-8"); would create a string from the UTF-8 encoded characters; but you don't need to create a string here anyway.
    //xmlText = convertToUTF(xmlText);
    File file = new File("C:\\temp.xml");
    file.createNewFile();
    // Write to temp file
    java.io.BufferedWriter out = new java.io.BufferedWriter(new java.io.FileWriter(file));This creates a Writer to write to the file using the platform's default character encoding, ie cp1252.
    out.write(xmlText);This writes the string to out using cp1252.
    So you have created a string treating UTF-8 as cp1252, then written that string to a file as cp1252, which is to be read as UTF-8. So it gets mis-decoded twice.
    As the data is already UTF-8 encoded, and you want the output, just write the binary data to the output file without trying to convert it to a string and then back again:// not tested, as I don't have your Oracle classes
    final InputStream inputStream = new BufferedInputStream((InputStream)xmlData.getBinaryStream());
    final int length = xmlData.length();
    final int BUFFER_SIZE = 1024;                  // these two can be
    final byte[] buffer = new byte[BUFFER_SIZE];   // allocated outside the method
    final OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
    for (int count = 0; count < length; ) {
       final int bytesRead = inputStream.read(buffer, 0, Math.min(BUFFER_SIZE, (length - count));
       out.write(buffer, 0, bytesRead);
       count += bytesRead;
    }Pete

  • Need to convert the binary data in blob field to readable format

    Hi,
    We need to convert the Binary data in the BLOB field to readable format and need to display it in Oracle Apps Environment,does anybody come across the similar requirement.
    please advise, thanks in advance.
    Regards,
    Babu.

    You could use standard Attachments functionality here ... if the blob is not in FND_LOBS, insert into FND_LOBS, fnd_attached_documents etc to enable viewing via "Attachments" to the entity the blob is related to.
    Gareth

  • How can I open different binary files from BLOB column ?

    If we store some type of binary file (XLS, DOC, PDF, EML and so on, not only pictures) in BLOB column how can I show the different contents? We use designer and forms 9i with PL/SQL.
    How can I copy the files from BLOB to file in a directory or how can I pass BLOB's content to the proper application directly to open it?

    The mime type is just a string as explained above (e.g. application/pdf...). There are lot of samples here and on metalink.
    E.g. add a column mime_type varchar(30) to your blob table. Create a procedure similar to the following:
    PROCEDURE getblob
    (P_FILE IN VARCHAR2
    IS
    vblob blob;
    vmime_type myblobs.mime_type%type;
    length number;
    begin
         select document, mime_type into vblob,vmime_type from myblobs where docname = p_file;
         length := dbms_lob.getlength(vblob);
         if length = 0 or vblob is null then
         htp.p('Document not available yet.');
         else
         owa_util.mime_header(vmime_type);
         htp.p('Content-Length: ' || dbms_lob.getlength(vblob));
         owa_util.http_header_close;
         wpg_docload.download_file(vblob);                
         end if;
    exception
         when others then
         htp.p(sqlerrm);
    END;
    Create a DAD on your application server (refer to documentation on how to create a DAD).
    Display the blob from forms (e.g. on a when-button-pressed trigger):
    web.show_document('http://myserver:port/DAD/getblob?p_file=myfilename','_blank');
    For storing blobs in a directory on your db server take a look at the dbms_lob package.
    For storing blobs in a directory on your app server take a look at WebUtil available on OTN.
    HTH
    Gerald Krieger

  • How can I turn off base64 email encoding in iPlanet Process Manager?

    Email sent out from a workflow running in the Process
    Manager seems to be base64 encoded. How can I turn
    off the encoding?

    No worries. Typically you can rename a machine by just changing the name System Preferences -> Sharing. But there is also a command line option to adjust the name, and if you don't use the command line option, the server freaks out and will alert you about the change forever. ie - for servers, you need to use the command I describe below.
    The command is called changeip and can be run from command line in Terminal.app. It is for manually chaning the ip address and or name of a machine. It basically has 4 parameters: old ip address, new ip address, old machine name, new machine name.
    Basically the command looks like this:
    sudo changeip OLDIPADDRESS NEWIPADDRESS OLDNAME NEWNAME
    If any value is being kept the same, just repeat the identical information as both the old and new value.
    Example 1: Changing the IP address and host name. This would update the machine's ip address to be 192.168.1.2 and its name would be update to my_new_name.
    sudo changeip 192.168.1.1 192.168.1.2 my_old_name my_new_name
    Example 2: Keeping the IP address the same but updating the name. This would update the machine's name to my_new_name but would keep the same ip address.
    sudo changeip 192.168.1.1 192.168.1.1 my_old_name my_new_name
    Most likely you're just wanting to update the name, in which case you should follow the second example. If you run this, be sure to reboot the machine afterwards and test to make sure that any enabled services are running properly.

  • Base64 Decoding/Encoding

    We are currently creating a tool for parsing the XML generated by BEA Weblogic 8.1 content repository and creating a directory structure similar to the one in content repository.
    After that we are also creating the reverse process for the above step i.e. creating an XML from the directory structure.
    All is fine till now however when we are trying to import the content to the content repository created as an XML in the second step above the images are not reflecting as the original ones. We have concluded that a possible reason is that the Base64 encoding/decoding that we are using is different from what BEA uses.
    Is there any chance that we can get the jar which us used by BEA for this purpose or if there is any alternative way out please let us know.

    HI,
    Base 64 encoding is a standard 64 character set encoding and decoding where results do not change based on the implementation. So whichever API you choose, it will give you the same results.
    The problem might be somewhere else.
    Thanks
    Vishnu

  • How to set username and password before redirecting to a RESTful webservice

    I am a .Net developer who has developed a webservice used by my ColdFusion colleagues. They are using ColdFusion 9 but I'm not sure if they have incorporated any of the newer features of ColdFusion in their apps. Here is a snippet of how they have been invoking the webmethods:
    <cfscript>
                         ws = CreateObject("webservice", "#qTrim.webServiceName#");
                         ws.setUsername("#qTrim.trimAcct#");
                         ws.setPassword("#qTrim.trimpwd#");
                         wsString=ws.UploadFileCF("#qTrim.webserviceurl#","#objBinaryData#", "#qFiles.Filename#", "Document", "#MetaData#");
                </cfscript>
    As I understand things, the .setUsername and .setPassword correspond to the Windows credentials the CF Admin set when the URL of the .Net webservice was "registered" and given its "name" (for the CreateObject statement above). I have 4 webmethods that are all invoked in this manner and this SOAP protocol works adequately for us. Please note that this ColdFusion web app authenticates anonymous remote internet users by prompting for a username and password and compares them to an application database (i.e. Microsoft calls this "forms authentication"). Because only a few Windows domain accounts are authorized to call this .Net webservice, the above code always uses the same username/password constants and it all works.
    My question involves the newest webmethod added to the .Net webservice. It requires that callers must invoke it as a RESTful service which means it must be invoked by its URL. Here is a snippet of C# code that invokes it from an ASP.NET webclient:
                string r = txtRecordNumber.Text;
                string baseurl = "http://localhost/sdkTrimFileServiceASMX/FileService.asmx/DownloadFileCF?";
                StringBuilder url = new StringBuilder(baseurl);
                url.Append("trimURL="); url.Append(txtFakeURLParm.Text);
                url.Append("&");
                url.Append("TrimRecordNumber="); url.Append(txtRecordNumber.Text);
                Response.Redirect(url.ToString());
    I assume a ColdFusion script could easily build a full URL as above with appended querystring parameters and redirect. Is there some way for the CF code redirecting to a RESTful webservice (by way of its URL) to set the Username and Password to this Windows account mentioned above? When the DownloadFileCF webmethod is hit it must be with the credentials of this special Windows domain account. Can that be set by ColdFusion someway to mimic the result of the SOAP technique (the first snippet above).
    I hope my question is clear and someone can help me make suggestions to my ColdFusion colleagues. Thanks.

    Can you clarify what you mean by "establish a different Windows identity"?  Usually passing identity to a web site or service means adding something to the request's HTTP headers.  This could be a cookie in the case of .NET forms authentication or the "Authorization" header in the case of basic authentication.
    The SOAP web service invocation code you posted does use basic authentication, according to the CF docs "ColdFusion inserts the user name/password string in the authorization request header as a base64 binary encoded string, with a colon separating the user name and password. This method of passing the user name/password is compatible with the HTTP basic authentication mechanism used by web servers."
    http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec13a13 -7fe0.html
    If you need to mimic the SOAP techinque you should have basic authentication enabled for your REST service endpoints.
    If your authentication method is different then CF developers will need to add the appropriate HTTP headers to their service calls.  Note that calling a REST service from CF would probably be accomplished using the CFHTTP tag if the service is designed to be consumed by the CF server.

  • BODS SOAP Web Service Connection error RUN-248005

    Hi Experts,
    I need help connecting SOAP web service to BODS. We have configured the initial set up by importing the functions from the WSDL that was provided to us. The WSDL provided us with a request and reply schema as follows:
    We then created the data service job that would consume the function call. An overview of the dataflow is as follows:
    When we run the job with null values for the source table the job returns no errors, but returns no data either into the destination table (Which we think is to be expected because we have no parameters to search on). If we add a value to the source table that is a required field for WSDL GET function (sys_ID) the job runs, but produces the error shown below:
    We configured the data flow by using a reference document that can be found at this link: http://www.dwbiconcepts.com/etl/23-etl-bods/158-web-service-call-in-sap-data-services.html.
    Any help in regards to why we are getting a “No response to web service error” would be much appreciated! Also, if further detail is needed please feel free to ask.

    Yes we did make progress. Follow the steps listed below.
    Pre-Configuration
    A WSDL for BODS can be provided from your vendor (Amazon or Twitter) or created in-house.  In my tutorial I will be using ServiceNow.  ServiceNow is a platform-as-a-service (PaaS) provider of IT service management (ITSM) software.
    The WSDL provided should look like this:
               https://<instance>.service-now.com/incident.do?WSDL
    To verify that the WSDL works you can open it in a browser to see the xml schema.  Since the WSDL is HTTPS the browser will prompt you to enter credentials in order to view it.  The username and password will need to be provided to you from vendor you are trying to connect to.
    BODS requires that any web service connection that is https to have a certificate saved to its internal configuration on the job server where the application resides. The certificate is referenced when the call goes out to verify authentication. 
    You can get the server certificate from the vendor who is providing the web service or you can also download the certificate from the browser and save it in base64 binary encoded format to a file and use that.  In my example I will be using Firefox to export.
    if you have fire fox, then on the left side before the URL Address bar there will be a lock icon, click on view certificate, select the details tab, select the *.service- now.com  and click on export, in the dialog box, select the Save as type X.509 Certificate (PEM), you can save this with any name on your machine.
    Now go to the JobServer machine, go to %LINK_DIR%\ext\ folder, open axis2.xml in notepad,
    since it's https uncomment the following tag (transportReceiver)
    <!--transportReceiver name="https" class="axis2_http_receiver">
    <parameter name="port" locked="false">6060</parameter>
    <parameter name="exposeHeaders" locked="true">false</parameter>
    </transportReceiver-->
    it should look line something below
    <transportReceiver name="https" class="axis2_http_receiver">
    <parameter name="port" locked="false">6060</parameter>
    <parameter name="exposeHeaders" locked="true">false</parameter>
    </transportReceiver>
    uncomment the following tag (transportSender) and comment out the parameter KEY_FILE and SSL_PASSPHRASE, enter the complete location of the certificate that you saved from the browser in the SERVER_CERT parameter. you can save the certificate also in this folder
    <!--transportSender name="https" class="axis2_http_sender">
    <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
    <parameter name="xml-declaration" insert="false"/>
    </transportSender>
    <parameter name="SERVER_CERT">/path/to/ca/certificate</parameter>
    <parameter name="KEY_FILE">/path/to/client/certificate/chain/file</parameter>
    <parameter name="SSL_PASSPHRASE">passphrase</parameter>
    -->
    this should look like
    <transportSender name="https" class="axis2_http_sender">
    <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
    <parameter name="xml-declaration" insert="false"/>
    </transportSender>
    <parameter name="SERVER_CERT">enter the certificate path</parameter>
    <!--parameter name="KEY_FILE">/path/to/client/certificate/chain/file</parameter-->
    <!--parameter name="SSL_PASSPHRASE">passphrase</parameter-->
    save this file and open this file is browser to make sure that the XML is valid
    ****How to set up multiple axis files****
    Creating a Datastore
    Select Project -> New- >  Datastore
              Datastore name: Applicable Name
              Datastore Type:  Web Service
              Web Service URL: https://<instance>.service-now.com/incident_list.do?WSDL
              Advance <<
              User name: *****
              Password: ******
              Axis2/c config file path: \Program Files (x86)\Business Objects\BusinessObjects Data           Services\ext\Service_now

  • Blob to base64 encoded XML

    Hi,
    We have a table with two columns (Name varchar2, Picture Blob).
    How do we get XML output containing rows from table, with Picture (blob column) being base64 encoded.
    Note: I have tried using utl_encode.base64_encode, but getting error due to large size of Picture.
    Thanks,
    Yj

    I am not sure what you finally want to accomplish (create a binary xml?), but to base64 encode a blob you could do it »stepwise«:
    declare
       bl            blob;   /* your picture blob */
       bl_enc        blob;  /*  encoded blob */
       offset        integer            := 1;
       amt           integer            := 20000;
    begin
       dbms_lob.createtemporary (bl_enc, false);
       while dbms_lob.substr (bl, amt, offset) is not null
       loop
          dbms_lob.append (bl_enc, utl_encode.base64_encode (dbms_lob.substr (bl, amt, offset)));
          offset := offset + amt;
       end loop;
       convert_to_xml(bl_enc);
       dbms_lob.freetemporary (bl_enc);
    end;
    /

  • Decode Base64 and save as binary file

    Hi there,
    I am using Adobe Air 1.5 with JavaScript and want to save a file to my hard
    drive. I get the data from a WebService via SOAP as a Base64 encoded string. A test-string is attached. When I try to decode it with
    the WebKit function "atob()" and try to save this bytes with following code, I can't open the file.
    this.writeFile = function(outputfile, content, append){
    var file =a ir.File.applicationStorageDirectory.resolvePath(outputfile);
    var stream = newa ir.FileStream();
    if (append) {
    stream.open(filea, ir.FileMode.APPEND);
    }else {
    stream.open(filea, ir.FileMode.WRITE);
    try{//Binärdaten
    stream.writeBytes(content0, , content.length);
    }catch(e){//Textdaten
    stream.writeUTFBytes(content);
    stream.close();
    The same happens when I try to open a file from my HDD and read in the bytes. When I decode it to base64, the string is not equal to the string, which is correct.
    I attached a working Base64 string, which I could convert back to a zip-file via a only encoder.
    So my question is, how can I decode a Base64 string and save the binary data to a file?
    Thank you for your help.

    I rewrote the Base64 decoder/encoder to use it with a ByteArray. Here ist the code:
    var byteArrayToBase64 = function(byteArr){
        var base64s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
         var encOut = "";
        var bits;
        var i = 0;
        while(byteArr.length >= i+3){
            bits = (byteArr[i++] & 0xff) << 16 | (byteArr[i++] & 0xff) << 8 | byteArr[i++] & 0xff;
              encOut += base64s.charAt((bits & 0x00fc0000) >> 18) + base64s.charAt((bits & 0x0003f000) >> 12) + base64s.charAt((bits & 0x00000fc0) >> 6) + base64s.charAt((bits & 0x0000003f));
        if(byteArr.length-i > 0 && byteArr.length-i < 3){
            var dual = Boolean(byteArr.length - i - 1);
            bits = ((byteArr[i++] & 0xff) << 16) | (dual ? (byteArr[i] & 0xff) << 8 : 0);
            encOut += base64s.charAt((bits & 0x00fc0000) >> 18) + base64s.charAt((bits & 0x0003f000) >> 12) + (dual ? base64s.charAt((bits & 0x00000fc0) >> 6) : '=') + '=';
        return encOut;
    var base64ToByteArray = function(encStr){
        var base64s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
         var decOut = new air.ByteArray(); 
        var bits;
        for(var i = 0, j = 0; i<encStr.length; i += 4, j += 3){
            bits = (base64s.indexOf(encStr.charAt(i)) & 0xff) <<18 | (base64s.indexOf(encStr.charAt(i +1)) & 0xff) <<12 | (base64s.indexOf(encStr.charAt(i +2)) & 0xff) << 6 | base64s.indexOf(encStr.charAt(i +3)) & 0xff;
            decOut[j+0] = ((bits & 0xff0000) >> 16);
              if(i+4 != encStr.length || encStr.charCodeAt(encStr.length - 2) != 61){
                   decOut[j+1] = ((bits & 0xff00) >> 8);
              if(i+4 != encStr.length || encStr.charCodeAt(encStr.length - 1) != 61){
                   decOut[j+2] = (bits & 0xff);
        return decOut;

  • Encode Bytecode in source field to base64 in target field

    Hello,
    I have already posted a similar question regarding base64 encoding of attachment. However now the bytecode is sent in a single field in the source message. This bytecode has to be encoded in base64.
    So far I have not found any solution to do so. I have read about the following API com.sap.aii.utilxi.base64.api.Base64  which should contain two static methods for encoding end decoding.
    However the package cannot be found when trying to import it into an UDF. As this API is not documented, could it be that it is not available anymore on PI 7.1?
    What other possibilites do I have? Do you have any idea? I
    Thank you very much!

    Hi Florian,
    com.sap.aii.utilxi.base64.api.Base64 is no official API, so there is no official documentation on this. Also, if you use this, there can be a possibility that changes might occur in this class without any notice.
    This class has two static methods:
    String encode(byte[]) // binary -> base64
    byte[] decode(String) // base64 -> binary
    Try looking for this class in aii_utilxi_misc.jar, which can be found on PI server - C:\usr\sap\*\*\j2ee\cluster\server0\bin\ext\com.sap.xi.util.misc
    Hope this helps.
    Regards,
    Neetesh

Maybe you are looking for

  • Updated .oam file appears as old version when placed in Muse

    I changed the background color of my Animate composition from black to white. I republished it and deleted the old version, but when I place the .oam file in my Muse site, it's the old version with a black background. I tried renaming the Animate pro

  • Incompatible atapi

    Hi I have an Msi PE Neo2 motherboard with a DVD Burner MS-8404A and this worked fine for about 4 months. Then one day when I booted up my machine at start up it gave an error "Sec Ide Atapi Incompatible Press F1 To continue. I pressed F1 and the syst

  • I don't trust DVD's

    Hi, this post is not so much about how to use the software but since the people on this site are talking about making movies i thought i'd ask.so here goes... what do people think about the future of keeping your valuable movies (ie home videos) on D

  • Possible to replace this green screen without masking?

    So here's what I'm working with: What I ultimately need to do is replace that green screen with some video footage. But there are a few problems that make this not all that straight forward... It starts off with nothing on top of it, but the photos a

  • OWB trying to create merge when should be update statement

    Hi there Have a problem whereby when set target update type of table to update, OWB trying to create a merge and failing with message merge sttament cannot be generated because column <column_name> is used for both matching and update. A matching col