Output Binary data to browser as file

I know this has been covered a thousand time, but every
example I am given does not work.
I am accessing a Java WebService to get a document (in this
case PDF). This WS has no WDSL, so I am hitting it through CFHTTP.
The WS returns me a hashmap with error codes etc. One element is a
Binary string.
I have done everything imaginable and the most I can do is
get the raw text to display. Unfortunately, saving a temp file then
using CFFILE is not an option for security reasons; however, if I
try this the file is corrupted and will not open. When I use
CFHEADER I get a complaint about java.lang.String. However,
ToBinary gives me a CF error with garbage text and no real error,
and BinaryDecode always whines about input and output encodings not
matching.
This is what I use the call the service:
<CFHTTP URL="HIDDEN" METHOD="GET" RESULT="testFN"
CHARSET="ISO-8859-1"></CFHTTP>
And these are somethings I have tried:
<cfheader name="Content-Type" value="pdf">
<CFHEADER NAME="Content-Disposition" VALUE="inline;
filename=my.pdf">
<CFCONTENT TYPE="application/pdf"
VARIABLE="#BinaryDecode(testFN.Filecontent, "Base64")#">
<cfscript>
context = getPageContext();
context.setFlushOutput(false);
response = context.getResponse().getResponse();
out = response.getOutputStream();
response.setContentType("application/pdf");
response.setContentLength(arrayLen(testFN.Filecontent));
out.write(testFN.Filecontent);
out.flush();
out.close();
</cfscript>
<cfcontent type="application/pdf; charset=ISO-8859-1">
<CFSCRIPT>
writeOutput(toString(testFN.Filecontent));
</cfscript>
None work. I either get a blank page, a CF error, or plain
text. Other Java application use this same WS without issue, so any
complaints about the WS have been ignored.
I need help badly. I am not sure what else to try.

Thanks for the reply.
I have had problems using BinaryDecode. It states the input
and output are not the same not matter what I use as the
binaryencoding. I can get a pdf binary object sent to the browser
by using this:
<CFHEADER NAME="Content-Disposition" VALUE="attachment;
filename=#fileNAME#.#fileEXT#">
<CFCONTENT TYPE="*/*"
VARIABLE="#ToBinary(ToBase64(docBINARY))#">
ToBinary nor ToBase64 work on their own (I get an error about
ByteArrays), but they seem to work together. However, now I get a
12 page PDF with 1 blank page and all the other pages generate
errors in the Adobe Reader. I have confirmed that the document
comes up fine in the Java applications that do basically the same
thing, but it is like ColdFusion does not understand the data type.
Unfortunately, our DEV and UAT systems are not exposed for me
to give you access. The Web Service I am consuming will never be
available externally, which is why I am building a CF passthrough
to display the documents to public users. The internal system will
output private contracts, so there are privacy issues related to
opening it up. Our prod deployment is very strict, so I cannot even
put up public pages for testing until all involved sign off on
functionality.
Obviously, the CFDUMP exceeds the text limit, so I cannot
post it either. :(
Edit: Also, I found out that the first byte of object is a
status code. I have parsed that off (why you now see docBINARY),
but I only see this as a square and have not been able to convert
this to the number code I should be getting.

Similar Messages

  • DAQ vi to perform digital write and read measurements using 32 bits binary data saved in a file

    Hi
    DAQ vi to perform digital write and read measurements using 32 bits binary data saved in a file
    Two main
    sections:
    1)     
    Perform
    write and read operations to and fro different spread sheet files, such that
    each file have a single row of 32bits different binary data (analogous to 1D
    array) where the left most bit is the MSB. I don’t want to manually enter the
    32 bits binary data, I want the data written or read just by opening a file
    name saves with the intended data.
          2)     
    And
    by using test patterns implemented using the digital pattern generator or  build digital data functions or otherwise, I need to
    ensure that the     
                binary data written to a spreadsheet file or any supported file type
    then through the NI-USB 6509 is same as the data read.
    I’m aware I can’t use the simulated
    device to read data written to any port but if the write part of the vi works I
    ‘m sure the read part will work on the physical device which I’ll buy later.
    My Plan
    of action
    I’ve
    created a basic write/read file task and a write/read DAQ task for NI USB 6509
    and both combine in a while loop to form a progress VI which I’m confuse of how
    to proceed with the implementation.
    My
    greatest problem is to link both together with the correct functions or operators
    such that there are no syntax/execution errors and thus achieve my intended
    result.
    This
    project is one of my many assignments for my master thesis, so please i’ll
    appreciate every help as I’m not really efficient with LabVIEW programming but
    I prefer it because is fun and interesting if I get to know it.
    Currently I’m
    practicing with LabVIEW 8.6/NI DAQmx 8.8 Demo versions and NI USB 6509
    simulated device.
    Please see
    the attached file for my novice progress, thanks in
    advance for the support
    Rgds
    Paul
    Attachments:
    DIO_write_read DAQ from file.vi ‏17 KB

    What does your file look like?  The DAQmx write is expecting a single U32 value, not an array of I64. 
    Message Edited by vt92 on 09-16-2009 02:42 PM
    "There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal

  • How to write binary data to browser - File Save dialog

    Hi,
    problem:
    i have a working webservice and i get binary data from that webservice.
    my dynpro java  already works and i have byte[] b which has my binary result.
    what i want:
    when the user clicks on the button, the action onActionGetResult() is executed and inside this method, the byteArray b exists. what can i do, to say the dynpro application that it should  send the binary data direct to the browser, so that the "File Save Dialog" appears and the user can save the file to the harddisk
    any ideas?

    I've found the solution:
    IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(
    res.getUrl(WDFileDownloadBehaviour.ALLOW_SAVE.ordinal()),
    res.getResourceName());
    window.show();
    this worked for me

  • Zip binary data and save zip file to disk at bsp

    Hi,
    I try to compress (zip) binary data (for example a picture) and then give it to a html page. I use the cl_abap_gzip=>compress_binary method and it seems to work. But when I save the zip-file to harddisk over the popup at the html - page, the file could not be opened. WinZip says that it is an unvalid archive.
    Can anybody help me?
    Here my example coding at the OnInitialization Event of the business server page:
    * event handler for data retrieval
    * local variables
    DATA: xsourcefile TYPE xstring.
    DATA: xzippedfile TYPE xstring.
    DATA: source_file_mime_type TYPE string.
    DATA: xzippedcontentlength TYPE i, xzippedcontentlengthstring TYPE
    string.
    * References
    DATA: o_mime_api TYPE REF TO if_mr_api.
    * processing
    * +++ Read File from MIME-Repository (binary) +++
    CALL METHOD cl_mime_repository_api=>if_mr_api~get_api
      RECEIVING
        r_mr_api = o_mime_api.
    CALL METHOD o_mime_api->get
      EXPORTING
        i_url              = 'SAP/ZGSD_SD_ADIS/test.gif'
    *    I_CHECK_AUTHORITY  = 'X'
      IMPORTING
    *    E_IS_FOLDER        =
        e_content          = xsourcefile
        e_mime_type        = source_file_mime_type
    *    E_LOIO             =
    *  CHANGING
    *    C_LANGUAGE         =
      EXCEPTIONS
        parameter_missing  = 1
        error_occured      = 2
        not_found          = 3
        permission_failure = 4
        OTHERS             = 5
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    * +++ create ZIP-File +++
    TRY.
        CALL METHOD cl_abap_gzip=>compress_binary
          EXPORTING
            raw_in                     =  xsourcefile
    *    RAW_IN_LEN                 = -1
    *    COMPRESS_LEVEL             = 6
          IMPORTING
            gzip_out                   = xzippedfile
            gzip_out_len               = xzippedcontentlength.
    * ... Länge Casten !
        xzippedcontentlengthstring = xzippedcontentlength.
    * ... Errorhandling
      CATCH cx_parameter_invalid_range . " Error-Handling
      CATCH cx_sy_buffer_overflow . " Error-Handling
      CATCH cx_sy_compression_error . " Error-Handling
    ENDTRY.
    * +++ Put ZIP-File in Response +++
    response->set_data( xzippedfile ).
    response->set_header_field( name  = if_http_header_fields=>content_type
              value = 'application/octet-stream' ).
    response->set_header_field( name  =
    if_http_header_fields=>content_length
              value = xzippedcontentlengthstring ).
    response->set_header_field( name  = 'Content-Disposition'
    value = 'inline;filename=test.zip' ).
    navigation->response_complete( ).
    Thanks Timo
    PS: I posted this question also at ABAP Forum.

    Hi,
    First you need to define your ext prog in SM69.
    It is simple though, specify:
    Command name: ZZIPBIN
    OS: (your os)
    System command: /yourpath/zzipbin
    Extra params allowed: checked
    Then you need to code this:
    data: table TYPE zeu_t_btcxpm.
    CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
        EXPORTING
          commandname                   = 'ZZIPBIN'
          additional_parameters         = param
          operatingsystem               = sy-opsys
          terminationwait               = 'X'
        TABLES
          exec_protocol                 = table
        EXCEPTIONS
          no_permission                 = 1
          command_not_found             = 2
          parameters_too_long           = 3
          security_risk                 = 4
          wrong_check_call_interface    = 5
          program_start_error           = 6
          program_termination_error     = 7
          x_error                       = 8
          parameter_expected            = 9
          too_many_parameters           = 10
          illegal_command               = 11
          wrong_asynchronous_parameters = 12
          cant_enq_tbtco_entry          = 13
          jobcount_generation_error     = 14
          OTHERS                        = 15.
    See also http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a8023505211d189550000e829fbbd/frameset.htm
    Eddy
    PS.
    Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
    Spread the wor(l)d!

  • How to output binary data to VISA

    i am interfacing labview with pic microcontroller through serial port using VISA. it is a stream of digital data which is being tranmitted ,stored in microcontroller and then retransmiited by microcontroller to other device...problem is when that data is converted to string to be given to VISA it makes 16bytes out of 16bits...for example if data was "11110000" (1byte) after converted to string it becomes 8 bytes and my microcontroller thibk that 8 bytes are coming................ please kindly tell me how to transmit binary data over serial port so that bit remains a bit dont become byte............................ data is 99bytes but after passing through VISA it become "99x16"bytes........ please help me
    regards
    umair

    The attached example in 8.0 converts a U16 into two U8, builds an array and with the Byte Array to String, converts to the hex string 8000 (two bytes). Note that the string indicator is configured for Hex Display (right click option).
    Now, when you say you want to see '1000001 on the hyperterminal of other PC', you are contradicting yourself. Hyperterminal cannot be set for binary display so if you want to see '10000001' in Hyperterminal, then you need 8 bytes (one for each ASCII character).
    I hope I have made myself clear.
    Attachments:
    U16 to Hex String.vi ‏8 KB

  • � problem: Outputting XML to a browser and file

    Hi, thanks in advance for any help,
    I have a program that produces xml needs to output it to a file and to the browser. Producing the xml is fine but the outputting part is giving me some problems:
    1. On ouputting to the browser, MSIE is complaining that the � symbol is an invalid character. I have tried wrapping it in CDATA tags but to no avail.
    2. On outputting to the file I am getting all ' symbols replaced by &apos; which isn't suitable either.
    I was wondering how I could set these formats so I get pure text out to the file but unicode encodings for browser.
    Below I have specified the code for outputting to the browser first and to a file second.
    Cheers.
    private void sendXML(HttpServletResponse pHttpServletResponse, Document pDocument) throws IOException{
    pHttpServletResponse.setContentType("text/xml");
    Writer lOut = pHttpServletResponse.getWriter();
    OutputFormat lFormat = new OutputFormat(pDocument, "UTF-8", true );
    XMLSerializer lSerial = new XMLSerializer(lOut, lFormat);
    lSerial.asDOMSerializer();
    lSerial.serialize(pDocument);
    lOut.close();
    private void writeDoc2File(Document pDocument, String pFilepath){
    try{
    Transformer xsltIdentity = TransformerFactory.newInstance().newTransformer();
    DOMSource domSource = new DOMSource(pDocument);
    StringWriter stringWriter = new StringWriter();
    StreamResult streamResult = new StreamResult(stringWriter);
    xsltIdentity.transform(domSource, streamResult);
    String xmlnode = stringWriter.toString();
    RandomAccessFile lRAF = new RandomAccessFile(pFilepath, "rw");
    lRAF.setLength(0);
    lRAF.seek(0);
    lRAF.writeBytes(xmlnode);
    lRAF.close();
    catch(IOException e){
    cLOG.debug(e.getMessage(), e);
    catch(Exception e){
    cLOG.debug(e.getMessage(), e);
    }

    I've just noticed that this site has a similar problem! The character I am having problems with is the UK pound symbol.

  • Using a "Scheduled Task" on a cisco controller to output data to a text file

    Can someone tell me if there is a way to run a Cron Job, RBA, or some other automated process on an 8510?  The idea would be to run the job every 5mins, and output the data to a text file.  Is this possible?

    In your script - you might be able to capture the error by putting your code inside a try/catch block. Something like:
    try {
    # do stuff
    } catch {
    $error.message | out-file c:\temp\script.txt
    G. Samuel Hays, MCT, MCSE 2012, MCITP: Enterprise Admin
    Blog:gsamuelhays.blogspot.com
    twitter:twitter.com/gsamuelhays

  • Convert Binary Data to string in MsSQL

    Hello,
    I am running a query for MSSQL database to get some file content which is stored in Binary data format in the database.
    I want to copy that file which is in the binary data format to a file in the text format.
    How can I do this?
    Regards,
    Sravanthi

    This is the expected result in the file that stores the data.
    ResultElement     
    WshOutputTest
    Errors/Failures     
    1 / -
    Incident     
    Error: some unexpected result     
    function main()     
    some additional info; eg. stacktrace
    Incident     
    Warning: some warning message     
    function main()
    some additional info; eg. stacktrace
    But I am getting the following stored in my file:::
    PK   FSH;
    output.xmlíT»NÃ@œ‰8¥‚
    *Æ)xH)      ‚R[ñÅ9AìȾðøy`nϖs1nBY>_vvfŸÊÏw„>±ÄÞ¡Q¢‚AWà§8ãWÉ1£=%š#ôÜá„^ü5BŒC ½+¬©iqËSSßñ-u&‚YŒù:»Ó™Ò²À#+9¯A©øDÔ*ù|¯y®E1fôìåN‘Ëëì»ü~¼ÕK{ ·0ßK֕2ÞbÞ*
    *©\‰–fŸW<gRyJk¹Ñ'—Ã6?T¦ÍOÈÐÿ‹x[³cwñCÌRÛ0^ˆy¼éù}–.y»|ýF(ÚéЎ%f—ÓÕu]›“¿Ù„õ§’§WNdÿLíy)û–q÷”¨'Ìá•ßRnZ"·ªa•Ãž:ÎßóûÏl?‚ÍQbm=w™k¸‹ûÙî>[‡ôÿyŸ_PKÙõ¡¬N    PK    FSH;Ùõ¡¬N  * 
    *output.xmlPK 8 †*
    I tried getting the Binary Stream with UTF-8 encoding style and no encoding style too but it didnt work.
    Thanks,
    Sravanthi.

  • Question about accesing binary data

    If I have a text file saved on my harddrive, how is it really stored? Can I access the raw binary data of the text file?

    Oh ok so I get the ascii values of the text. No, you get the bytes in your file. Whenever you read, through Java or anything else, you get bytes.
    The interpretation of those bytes as ASCII or Unicode or a Word file or an mp3 or whatever occurs after the bytes are read.
    And I
    take it that the pc stored the values as 1's and 0's.Huh? It's always just ones and zeroes that are stored. The letter "A" is never stored. It's just the binary pattern that corresponds to the number 65, which is interpreted in some contexts as a captial A.
    So is 77k of text sotred as 77k of binary on my pc?The number of bytes you'll get this way is equal to the number of bytes in the file, with two caveats:
    1) What I said in my last post about the file size potentially changing between checking size and reading.
    2) File systems allocate blocks--usually 512 or 1K bytes, so if your file is, say 1600 bytes long, it might show up as 2k in in Windows Explorer, but the number of bytes read will be 1600.

  • How to append binary data to existing file in OSB

    Hi,
    I have an OSB project that I need for it to append binary data via ftp.  Here's my current flow:
    MFL binary output --> Replace $body with mfl binary output --> Publish to action (Business service that's configured to ftp binary data).
    However, when the data is ftp'ed the following error is thrown:
    URI = ftp://xxx:21/opt/home/zzz/logs
    Request metadata =
        <xml-fragment>
          <tran:headers xsi:type="ftp:FtpRequestHeaders" xmlns:ftp="http://www.bea.com/wli/sb/transports/ftp" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:xsi="h
    ttp://www.w3.org/2001/XMLSchema-instance">
            <ftp:fileName>11802_insert_oh_xfrmr.eai_data</ftp:fileName>
          </tran:headers>
          <tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>
          <ftp:isFilePath xmlns:ftp="http://www.bea.com/wli/sb/transports/ftp">false</ftp:isFilePath>
        </xml-fragment>
    Payload =
    19266787^CLLL^C711791^CLLL^C^C1178213^CSingle Phase(1)^C63185066204^CA^CConstructed^C358880 NW 4 DR LK MONTAZA^C120/240^C09361^CN/A^CProposed Remove^CAerial^C45718100^C
    Unknown^C^CNo^CNormal Closed^CClamp^CA^C1^C2-Cover^C19266796^CNo^CNo^C15^C^CYes^CYes^CYes^C13200Y/7620 X 22860Y/13200^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C
    ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C19266641^Coh_fuse_switch^C63086930001^C4^CN31^CDD0613^C22.9^C63376474601^C8129580^CFalse^C4^COke
    echobee^C43^C0^Cdefault^CYes^C
    >
    ####<Nov 6, 2013 2:28:23 PM EST> <Error> <WliSbTransports> <goxsd1604> <osb_server1> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<
    anonymous>> <BEA1-4B688443B66FA09FFE75> <d2b4601b2fffd9b7:6b9f2297:1422a857ee8:-8000-000000000000171b> <1383766103889> <BEA-381105> <Error occured for the service endpo
    int: com.bea.wli.sb.transports.TransportException: Unable to open data connection. Message is Received error response (553) from FTP server [mpsd1] IP [10.111.19.32] po
    rt [21] status [connected] upon executing command [stor opt/home/zzz/logs/11802_insert_oh_xfrmr.eai_data.a]
    com.bea.wli.sb.transports.TransportException: Unable to open data connection. Message is Received error response (553) from FTP server [mpsd1] IP [10.111.19.32] port [2
    1] status [connected] upon executing command [stor opt/home/icanadm/logs/11802_insert_oh_xfrmr.eai_data.a]
            at com.bea.wli.sb.transports.ftp.connector.FTPTransportProvider.sendMessage(FTPTransportProvider.java:422)
    From what I understand the error code 553 represents a bad file name.  The file name that I'm supplying is 11802_insert_oh_xfrmr.eai_data but it appears that the name is changed to 11802_insert_oh_xfrmr.eai_data.a .  So I did the obvious and changed the file several different ways (without the .eai_data extension, removed the numbers from the file name) but still no luck. 
    Any suggestions?
    Thanks,
    Yusuf

    Thanks Eric.
    I'm using the JCA FTP adapter instead and noticed it's appending the test generated data supplied by the OSB test console.
    However, how can I ensure that the MFL output that I need to append will be placed on a new line? 
    Also, how should I map/assign the MFL binary output to the opaqueElement type base64Binary defined in the WSDL file below?
    Once again here's a sample payload that I need to ensure will be presented on a new line:
    19266787^CLLL^C711791^CLLL^C^C1178213^CSingle Phase(1)^C63185066204^CA^CConstructed^C358880 NW 4 DR LK MONTAZA^C120/240^C09361^CN/A^CProposed Remove^CAerial^C45718100^C
    Unknown^C^CNo^CNormal Closed^CClamp^CA^C1^C2-Cover^C19266796^CNo^CNo^C15^C^CYes^CYes^CYes^C13200Y/7620 X 22860Y/13200^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C
    ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C19266641^Coh_fuse_switch^C63086930001^C4^CN31^CDD0613^C22.9^C63376474601^C8129580^CFalse^C4^COke
    echobee^C43^C0^Cdefault^CYes
    Here's the WSDL file that gets generated for the FTP adapter:
    <wsdl:definitions
         name="PutGenericDevice"
         targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/ftp/AMS/Project1/PutGenericDevice"
         xmlns:jca="http://xmlns.oracle.com/pcbpel/wsdl/jca/"
         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
         xmlns:tns="http://xmlns.oracle.com/pcbpel/adapter/ftp/AMS/Project1/PutGenericDevice"
         xmlns:opaque="http://xmlns.oracle.com/pcbpel/adapter/opaque/"
         xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
        >
      <plt:partnerLinkType name="Put_plt" >
        <plt:role name="Put_role" >
          <plt:portType name="tns:Put_ptt" />
        </plt:role>
      </plt:partnerLinkType>
        <wsdl:types>
        <schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/opaque/"
                xmlns="http://www.w3.org/2001/XMLSchema" >
          <element name="opaqueElement" type="base64Binary"/>
        </schema>
        </wsdl:types>
        <wsdl:message name="Put_msg">
            <wsdl:part name="opaque" element="opaque:opaqueElement"/>
        </wsdl:message>
        <wsdl:portType name="Put_ptt">
            <wsdl:operation name="Put">
                <wsdl:input message="tns:Put_msg"/>
            </wsdl:operation>
        </wsdl:portType>
    </wsdl:definitions>
    Here's the JCA details:
    <adapter-config name="PutGenericDevice" adapter="FTP Adapter" wsdlLocation="PutGenericDevice.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
      <connection-factory location="eis/ftp/DssPut"/>
      <endpoint-interaction portType="Put_ptt" operation="Put">
        <interaction-spec className="oracle.tip.adapter.ftp.outbound.FTPInteractionSpec">
          <property name="PhysicalDirectory" value="/opt/eai/ofmw/Oracle/Middleware_R7/logs"/>
          <property name="FileType" value="binary"/>
          <property name="Append" value="true"/>
          <property name="FileNamingConvention" value="dummy.txt"/>
        </interaction-spec>
      </endpoint-interaction>
    </adapter-config>
    Thanks,
    Yusuf

  • Writing binary data to a file without carriage returns every 512 bytes

    Is there a VI for writing binary data to a file without carriage returns being inserted every 512 bytes?
    Thanks

    Hi Momolxg,
    I could be way off on this. I tried to simulate what you've done by
    making a for loop that would run a set number of times. For my example I
    used 1025. I wired the iteration terminal to a 'Write to SGL File.vi'
    outside the loop with indexing enabled. It wrote the SGL data from 0 to
    1024 to the file. I then read the file with a 'Read Characters from
    File.vi' and searched the output for a carriage return (0D hex). It was
    found five times. The reason why was the SGL number it was reading had a
    13 (0D hex) in it. Perhaps you're running into a similar problem?
    I tried it again, this time using the 'Write to I16 File.vi'. The
    carriage return was found five times: the 28th character the first time
    then on the 512th character four consecutive time
    s after that. I suppose
    that makes sense that you'd find a 0D in the numbers at equal spacings if
    they're incrementing this way... In this case the carriage returns you're
    seeing are actually numbers from your data.
    One big difference is that I'm using a set pattern of numbers. This
    doesn't appear to be your case. Is there a better way we can duplicate
    your problem? It sounds interesting. Again my simulation could be way
    off. (I'm also running this on LV60 for Linux so my results could be
    different)
    - Kevin
    In article <[email protected]>,
    "momolxg" wrote:
    > Is there a VI for writing binary data to a file without carriage returns
    > being inserted every 512 bytes? Thanks

  • How to create a form which has browse option ? Then how to upload the data from the excel file to table in Oracle DB?

    Hi Everyone,
    I am new to Oracle forms. I have a requirement where user wants a form which can be used to browse a excel file from his/her system. Also after browsing the file the user should be able to load the data from the file to a table in the Oracle DB.
    Any help pointers would be appreciated.
    Thanks,
    Satya
    Message was edited by: user12098633

    Hi Marcus,
    I am using EBS (E- Business Suite) ERP and version is 11.5.10.2
    My database version is as below
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE
    11.2.0.3.0
    Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    I want to move csv file via EBS only. Average size of this will be max 600-700 bytes.
    Program should be in pl/sql package or concurrent program or custom .fmb (d2k forms) or custom .rdf (d2k report) or through alert. I am not using samba.

  • How to extract binary data from a File?

    Hello there!
    Hope I'm right here.
    I have a slight problem with a file containing text- and binary-data. At the beginning of the file is only some text followed by some html-code and at the end is some binary stuff like a pdf oder an image (jpg/gif).
    My problem is now how to split these parts and save them in the suitable format. The text and the html are no problem, but I don't know how to extract the binary data. I tried it out with an Inputstream, but I don't know how to find the exact position where the binary data begins.
    Anyone have an idea how I can solve this?
    Thanks in advance and sorry for my bad english.

    I don't believe a bullet-proof solution exists.
    If you know where the HTML ends, you may skip whitespace and then assume the rest is binary data. Or, if you know the first bytes of the binary data, you may locate those. With either of these solutions, though, you risk coming across a file where it doesn't work as expected, for example if the first byte of the binary data happens to match a whitespace character.

  • Download file problem for binary data?

    Dear All,
    I have wrote a jsp file to do download page. I have used a piece of code from the JDC to this. This code will prompt the download dialog box each time user clicks the download button. The code itself will set the content type for different application. The code is like below:
    try
    java.io.File fileobj = new java.io.File(strFolder + strFile);
    response.setContentType(application.getMimeType(fileobj.getName()));
    response.setHeader("Content-Disposition","attachment; filename=\""
    + strFile + "\"");
    java.io.FileInputStream in = new java.io.FileInputStream(fileobj);
    int ch;
    while ((ch = in.read()) != -1) {
    out.write(ch);
    out.flush();
    in.close();
    } catch(Exception e)
    The code can download and handle text file correctly when it is openned in the text editor or inside the IE. But when a PDF file or Image is downloaded and openned in the PDF viewer or image viewer, it is corrupted and cannot be viewed. What is the problem? Any ideas?
    So, I wonder this code can handle binary data or not. It is seen like there is no different code to handle text and binary data in Java/Jsp.
    Thank you very much!
    Best Regards,
    Rockyu Lee
              

    Add following lines to .tld file (custom tag definition)
    <tag>
    <name>downloadbinary</name>
    <tagclass>org.rampally.DownloadBinaryTag</tagclass>
    <bodycontent>JSP</bodycontent>
    </tag>
    Add following line to JSP files.
    In JSP, keep one line of source. Make sure that there are no space and additional line feeds at the any where
    in the JSP files except JSP tags.
    <%@ taglib uri="/WEB-INF/taglibs/mb.tld" prefix="mytags" %>
    <mytags:downloadbinary />
    I am hoping that you have all required parameters such as fileName to download, etc.
    in your session or request object.
    Tag class ....
    public class DownloadBinaryTag extends TagSupport {
         public int doEndTag() throws JspException {
              // TODO: get binary data from filename or
              // binary data buffer from datase.
              // I am making it simple .. assume that it is a request parameter for
              // you test easily.
              String fileName = request.getParameter( "filename" );
              java.io.File file = new java.io.File( fileName);
              java.io.DataInputStream dis;
              try {
                   dis = new java.io.DataInputStream(new FileInputStream(fileName));
              } catch (FileNotFoundException e) {
                   // do error handling ...
                   return EVAL_PAGE;
              BinaryUtil.sendBinaryFile( dis, (HttpServletResponse) pageContext.getResponse(), contentType );
              return EVAL_PAGE;
    public class BinaryUtil
         static public void sendBinaryFile( DataInputStream dis,
                                  HttpServletResponse response,
                                  String contentType ) {
              try {
                   response.setContentType(contentType);
                   String fileName="test.pdf";
                   response.setHeader("Content-disposition", "inline; filename=" + newFileName );
                   ServletOutputStream sout = response.getOutputStream();
                   int len;
                   byte[] data = new byte[128 * 1024];
                   while ((len = dis.read(data, 0, 128 * 1024)) >= 0)
                        sout.write(data, 0, len);
                   sout.flush();
                   sout.close();
              } catch (Exception e) {
                   System.out.println(e.getMessage());
         static public void sendBinaryFile( byte[] data,
                                  HttpServletResponse response,
                                  String contentType ) {
              try {
                   response.setContentType(contentType);
                   String fileName="test.pdf";
                   response.setHeader("Content-disposition", "inline; filename=" + newFileName );
                   ServletOutputStream sout = response.getOutputStream();
                   sout.write(data);
                   sout.flush();
                   sout.close();
              } catch (Exception e) {
                   System.out.println(e.getMessage());
    You may have to change 'inline' to 'attachment' if you do not want IE to inline the document.
    That's all!!.. Hope this helps...!

  • Convert Script output data to Text(.txt) file & send mail with attachment.

    Hi All,
    Requirement: I shulb be able to conver th Script output data to Text(.text) file & send a maill with attachment with this text file. Formant of text file should be like output of Print priview.
    Plese sugget with Function modules to cover as Text file.
    I am able to converting the Script output data to PDF and sending mail with attachment. So I don't want PDF file now.
    Thanks in advance.

    Hi, Thanks for responst.
    We can convert the Scirpt output to PDF file by using OTF function module and the PDF file looks like Print Privew output.
    Same like this I want Script out in NOTEPAD (.txt). Is that possible, Plz sugget with relavent Function Modules.
    Thanks.

Maybe you are looking for

  • How do I open and use a large table from Word in Pages?

    I upgraded my MBP from Snow Leopard to Mountain Lion a couple days ago.  I knew that my old Word application wouldn't work, but several Apple people assured me that Pages could handle my old docs, including tables. So, I purchased and installed Pages

  • PO release strategy status

    Dear friends is there any standard T code where i can get to know status of any PO pending for approval ie at which level this PO is waiting for approval no me23n Regards Atul Ranjan

  • Demand Planning: How to create a forecast in ODP

    Our client is using Oracle Financials OM etc however it currently uses a separate tool for forecasting. We are planning to start forecasting in Oracle Demand Planning. Following is the simplified calculation for forecasting, how can this be done in O

  • Disable TRACE/TRACK methods

    We run a secure web service using your SunONE Application Server. The latest version of the Nessus network scanner reports that there is a vunerability in the web server. How do I disable the TRACE and TRACK HTTP methods so that the web server won't

  • Unlimited tablespace and dba_ts_quotas dynamic view

    Hi everybody, I have read an article about the dba_ts_quotas and particularly the following query : select username, tablespace_name, bytes/1024/1024 used, max_bytes/1024/1024 quota from dba_ts_quotas order by username which returns for each user and