Adapter development: binary data and adapter specific properties?

Hi,
We have succesfully developed our own SFTP adapter based on the J2SSH Maverick library (http://www.sshtools.com/showMaverick.do) and the sample file adapter that comes with XI.
There are 2 features we would like to implement as well, but lack the necessary documentation and sample code.
<b>1st Binary data</b>
We do not succeed in transporting binary data via our SFTP adapter (both text and xml go fine).  While debugging, we see that the binary data are correctly picked up, but the actual payload appearing in message monitoring is much larger.  When we write the message to a file again, the data have changed (size has e.g. increased importantly from 127180 bytes to 218198 bytes).  According to the sample adapter code,  the contenttype "application/octet-stream"  should be specified.  But the standard XI file adapter itself seems to specify "application/octet-stream".
<b>2nd Adapter specific properties (DynamicConfiguration)</b>
How can we set adapter specific properties in our own adapter code?  Where are the Java docs of the API?  Is this somewhere documented?
If you would have more information (or pointers), please post it as a response to this message.
Kind regards, Guy Crets
<b>Code snippet:</b>
XIMessageFactoryImpl mf = new XIMessageFactoryImpl();
Message msg = mf.createMessageRecord(fromParty, toParty, fromService, toService, action, actionNS);
msg.setDeliverySemantics(DeliverySemantics.ExactlyOnce);
// In case of XML documents it is not necessary to set the contentType or encoding
// But: take care that the encoding definiton in the XML document corresponds to the encoding used
if (msgText.indexOf("<?xml") != -1)
  // Check whether the payload is a XML document. If not, treat it as binary to demonstrate how
  // binary main documents work
  // First create a XML Payload                    
  XMLPayload xp = null;
  xp = msg.createXMLPayload();
  xp.setText(msgText);
  xp.setName("MainDocument");
  xp.setDescription("XI AF Sample Adapter Input: XML document as MainDocument");
  msg.setDocument(xp);
// In case of binary documents use the Payload super class methods to fill the XMLPayload object
else
  // Check whether the payload is a XML document. If not, treat it as binary to demonstrate how
  // binary main documents work
  // First create a XML Payload                    
  XMLPayload xp = null;
  xp = msg.createXMLPayload();
  //xp.setContentType("application/octet-stream");
  xp.setContentType("application/xml");
  xp.setName("MainDocument");
  xp.setDescription("XI AF Sample Adapter Input: Binary as MainDocument");
  xp.setContent(msgData);
  // Finally set the main document in the message
  msg.setDocument(xp);          
TRACE.debugT(SIGNATURE, XIAdapterCategories.CONNECT_AF, "Message object created and filled.");
ModuleData md = new ModuleData();
md.setPrincipalData(msg);

Hello Moorthy,
I know this part of the documentation.
So I set the indicator within the communication channel.
Now, I have to fill the dynamic configuration during my mapping. My code looks like following:
DynamicConfigurationKey keyURL =  DynamicConfigurationKey.create("http://sap.com/xi/XI/System/HTTP", <b>XXXXX</b>);
// access dynamic configuration
DynamicConfiguration conf = (DynamicConfiguration) param.get (StreamTransformationConstants.DYNAMIC_CONFIGURATION);
// set value
conf.put(keyURL, url);
So what has to be filled instead of XXXXX ?
Regards,
  Marc

Similar Messages

  • Confusion regarding Binary data and byte arrays

    HI guys,
    I have a question...i am going to send some binary data...the format of that data is that first two bytes is the lenght of the data and then follows that data. Here i have one confusion. e.g. i want to say that the lenght of my data is 1000 bytes. How do i do it.
    coz if i do something like this.
    int k = 1000;//the length of my data
    String binaryString = Integer.toBinaryString(k);
    byte[] binaryData = binaryString.getBytes();
    and then if i say binaryData.lenght, i see a lenght of 10, as the binary string which
    is generated is -> 1111101000. i guess its obivious as this byte array is nothing but perhaps a character array with each character occupying one thread...so what exactly is the difference between byte array and binary data. and in the above said condition how do i send the binary data?
    Also adding to my confusion is the fact that i have a file which contains binary data, but that data is not 10010101 type of data...its just some absurd characters. How do we explain this.
    i would be highly grateful if you could explain me the solution to this problem.
    I am not getting as to how to go about it.
    its urgent..pls help...

    one sec..actually i dont want to 'read' the two bytes. That i know how to do? but The thing is that i want to write a binary stream. right? so in that the first two bytes should be the size of the data, followed by the data itself. So i want to write the first two bytes, which should contain the size of data (as a matter of fact i have that binary data in a byte array). But my question is , that if i say the size of data is 1000 (bytes , since, as i said i am gettting the data as a byte array), how do i write this in my binary stream as 1000 in this case would be an int. right? which is four bytes. So essentially that byte array (which contains binary data) i have to forward to somewhere, say X , but X reads binary data in the following way...it expects the first two bytes to give him info regarding the size of the data to follow and then it starts reading the data from the third byte onwards till the size of the data (which it got by reading first two bytes)...i hope i could communicate my confusion better this time

  • 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!

  • Binary Data and JSP

    Hi all I have a basic doubt. How does Servlets is preferred technology to generate binary data than JSP? Any limitation in JSP?

    Okay,
    When you write a JSP file, you type it in text, and all the text you type is sent to the client that requests your page. Everything is sent including carriage returns, spaces, tab characters and anything you have type into the file. Only things that are inside <% and %> do not get sent through. If you have several blank lines at the end of the file they will be sent to the client and may cause issues if you are writing binary data that needs to be handled by an application.
    With Servlets you have to write data to the outputstream you get from the (cant quite remember) response.getOutputStream() method. This ensures that only what you want to send gets sent to the client.
    It sepends on what you need it for. If it doesnt matter what you send through then JSP can be used to write binary data. In one application I had to send through sound files to the client and any extra data would only corrupt the sound, so it had to be sent using servlets.
    Does that help?

  • Binary Data and Servlets

    Hi all I have a basic doubt. How does Servlets is preferred technology to generate binary data than JSP? Any limitation in JSP?

    I just answered this in the JSP forum

  • Saving and Loading specific properties of an Image

    Hey everyone. I'm currently in the process of developing a game which allows you to customize the color (hue) of your character via a slider. What I would like to happen is: Upon clicking either Accept or Play, it will save the current hue of the image, navigating back to that page will load what was previously saved (hue), as well as when starting the game, it will replace the standard graphic with the previously saved image.
    Below is the code I have right now that pertains to the image with a basic non-functioning properly saving and loading code:
    import flash.events.KeyboardEvent;
    // open a local shared object called "myStuff", if there is no such object - create a new one
    var savedstuff:SharedObject = SharedObject.getLocal("myStuff");
    Accept.addEventListener(MouseEvent.CLICK, SaveData);
    PlayBTN.addEventListener(MouseEvent.CLICK, LoadData);
    function SaveData(MouseEvent){
               savedstuff.data.username = Sliders.Dino.MovieClip // changes var username in sharedobject
               savedstuff.flush(); // saves data on hard drive
    function LoadData(event: MouseEvent)
               if(savedstuff.size>0){ // checks if there is something saved
               Sliders.Dino.MovieClip = savedstuff.data.username} // change field text to username variable
    // if something was saved before, show it on start
    if(savedstuff.size>0){
    Sliders.Dino.MovieClip = savedstuff.data.username}
    What I have above is only saving the actual image, which is inside a movie clip names Sliders.
    Below is the Class I am using that associates with the slider that changes the hue of "Dino".
    package
              import flash.display.Sprite;
              import fl.motion.AdjustColor;
              import flash.filters.ColorMatrixFilter;
              import fl.events.SliderEvent;
              public class Main extends Sprite
                        private var color:AdjustColor = new AdjustColor();
                        private var filter:ColorMatrixFilter;
                        public function Main():void
                                  /* Required to create initial Matrix */
                                  color.brightness = 0;
                                  color.contrast = 0;
                                  color.hue = 0;
                                  color.saturation = 0;
                                  /* Add Listeners function */
                                  addListeners();
                        private final function addListeners():void
                                  colorPanel.hueSL.addEventListener(SliderEvent.CHANGE, adjustHue);
                        private final function adjustHue(e:SliderEvent):void
                                  color.hue = e.target.value;
                                  update();
                        private final function update():void
                                  filter = new ColorMatrixFilter(color.CalculateFinalFlatArray());
                                  Dino.filters = [filter];
    Overall what I'm asking for is: How do I get it to save the current hue of an image by clicking a button, and then having that previously saved image be loaded upon reloading or clicking a button? To me, it doesn't seem like it should be too hard, but for some reason I can not grasp it.
    Thanks in advance for reading this and for any assistance you have to offer!

    This is the Class that you told me to use:
    package
              import flash.display.Sprite;
              import fl.motion.AdjustColor;
              import flash.filters.ColorMatrixFilter;
              import fl.events.SliderEvent;
              import flash.net.SharedObject;
              public class Main extends Sprite
                        private var color:AdjustColor = new AdjustColor();
                        private var filter:ColorMatrixFilter;
                        private var so:SharedObject;
                        public function Main():void
                                  color.brightness = 0;
                                  color.contrast = 0;
                                  color.saturation = 0;
                                  so = SharedObject.getLocal("myStuff");
                                  if (so.data.hue)
                                            color.hue = so.data.hue;
                                  else
                                            color.hue = 0;
                                  update();
                                  addListeners();
                        private final function addListeners():void
                                  colorPanel.hueSL.addEventListener(SliderEvent.CHANGE, adjustHue);
                        private final function adjustHue(e:SliderEvent):void
                                  color.hue = e.target.value;
                                  so.data.hue = color.hue;
                                  so.flush();
                                  update();
                        private final function update():void
                                  filter = new ColorMatrixFilter(color.CalculateFinalFlatArray());
                                  Dino.filters = [filter];
    And this is the FLA Code:
    import flash.events.KeyboardEvent;
    // open a local shared object called "myStuff", if there is no such object - create a new one
    var savedstuff:SharedObject = SharedObject.getLocal("myStuff");
    Accept.addEventListener(MouseEvent.CLICK, SaveData);
    PlayBTN.addEventListener(MouseEvent.CLICK, LoadData);
    function SaveData(MouseEvent)
              savedstuff.data.username = Sliders.Dino.MovieClip;// changes var username in sharedobject
              savedstuff.flush();
              // saves data on hard drive;
    function LoadData(event: MouseEvent)
              if (savedstuff.size > 0)
              {// checks if there is something saved
                        Sliders.Dino.MovieClip = savedstuff.data.username;
              }// change field text to username variable
    // if something was saved before, show it on start
    if (savedstuff.size > 0)
              Sliders.Dino.MovieClip = savedstuff.data.username;

  • [ANN] New Oracle Developer Days Dates and Locations

    New dates for the Oracle Developer Days.
    These include J2EE training as well.
    Look for a location near you:
    http://www.oracle.com/go/?&Src=1587968&Act=43

    Here is a list of the location currently planed:
    Bellevue, Web Services Jan 20-21
    Redwood Shores, Best Practices for J2EE Development Jan 27
    Redwood Shores, Web Services Jan 28-29
    Oklahoma City, Introduction to J2EE Feb 2
    Oklahoma City, Best Practices for J2EE Development Feb 3
    Oklahoma City, Web Services Feb 4
    Oklahoma City, Web Services Feb 5
    Cincinnati, Introduction to J2EE Feb 9
    Cincinnati, Best Practices for J2EE Development Feb 10
    Cincinnati, Web Services Feb 11
    Cincinnati, Web Services Feb 12
    Orlando, Introduction to J2EE Feb 23
    Orlando, Best Practices for J2EE Development Feb 24
    Orlando, Web Services Feb 25
    Orlando, Web Services Feb 26
    There are other topics covered as well.

  • How to handling Binary data and File operation?

    Hello Everyone,
    I think this question might have been asked a lot of time but I was unable to find one solution so, please help needed in this from all you guys..
    I am creating a byte[] of the media files of mp4, and jpg, using the below code,,
    File ff = new File(filename);
            fos = new FileOutputStream(ff);
            int b;
            byte[] f = this.getMediaFile();
            for (b = 0; b < f.length; b++) {
                if (f[b] != -1) {
                    fos.write(f);
    fos.flush();
    fos.close();
    After i convert it i have to store it in the MySql Database as BLOB object, for retrieving byte[] from the database is simple i can do that also successfully with this code.java.sq.Blob obj = (java.sql.Blob) rs.getBlob("file");
    InputStream is = null;
    ByteArrayOutputStream bc = null;
    is = obj.getBinaryStream();
    bc = new ByteArrayOutputStream();
    int b;
    while ((b = is.read()) != -1) {
    System.out.print(b + " ");
    bc.write(b);
    Now the real problem is that when i want to recreate a mp4 audio or video file i am unable to do so, the file created is smaller in size and also it doesn't get played in windows default player nor VLC. I am able to get the image file of jpg format using the BufferedImage & ImageIO.writer();
    How do i do for mp4 file, have no clue for that.
    Pleases help out with this.
    Thanks..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    if (f[b] != -1) {I don't get that line. What if you try to output the data without that condition, like this:
    fos = new FileOutputStream(ff);
            byte[] f = this.getMediaFile();
            for (int b = 0; b < f.length; b++) {
                 fos.write(f);
    fos.close();

  • How to convert binary data to PDF and attach to the particular po

    our client wants to attach the pdf coming from portal as attachment to that particular PO. From portal the pdf will come in binary format. Find how will we convert that binary data back to pdf and attach to the PO in R/3?

    Hi,
    You can downlaod Binary data into PDF using GUI_DOWNLOAD...pass the binary data and the BINSIZE...
    santhosh

  • How to convert XML data into binary data (opaque data)

    Hi,
    I am trying to develop a process that delivers files after reading data from a database.
    However, it is required not to deliver the data immediately. We want to perform some checks before the files get written.
    So the way we want to design this is,
    1. Read data from database (or any other input). The data is in XML format (this is a requirement, as in general, we have xml data)
    2. This data is written, opaquely, to a JMS queue that can store binary data, along with what is the filename of the file that would be written (filename is passed using JMS Headers)
    3. When required, another process reads the JMS queue's binary data, and dumps into a file
    The reason I want to use opaque data while inserting in the JMS queue is, that enables me to develop a single process in Step 3 that can write any file, irrespective of the format.
    My questions are
    1. How to convert the xml data to opaque data. In BPEL I may use a embedded java, but how about ESB. Any other way....?
    2. how to pass filename to the jms queue, when payload is opaque. Can I use a header attribute...custom attributes?
    3. Which jms message type is better for this kind of requirement - SYS.AQ$_JMS_BYTES_MESSAGE or SYS.AQ$_JMS_STREAM_MESSAGE

    Ana,
    We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
    Let me know if this helps.

  • Binary Data

    Hi,
    I'm developing a program that reads and writes data via http. Although I am having a problem with the response that the server is giving me. The server is sending me binary data and I'm unsure how to decode it. For example, part of the below request returns 41 97 33 33, which is supposed to convert to 18.90. Here is the code that I'm using to connect and read the data.
    URL urlq = new URL(url);
    URLConnection streamrConnection = urlq.openConnection();
    streamConnection.setDoOutput(true);
    DataInputStream dis = new DataInputStream(streamConnection.getInputStream());
    float inputLine;
    while ((inputLine = dis.readFloat()) != -1) {
    System.out.printf("%f",inputLine);
    The output of this code is
    0.000000
    0.000000
    3367254360064.000000
    0.000000
    -0.000000
    -0.000000
    -0.000000
    -0.000000
    0.000000
    0.000000
    -67013848328296200000.000000
    -0.000000
    -0.000000
    -0.000000
    -0.000000
    -206013237815188270000000.000000
    0.000000
    1084495953920.000000
    Could anyone tell me the proper way to decode binary data coming from a server over http? Thanks for any help.

    jjstuart79 wrote:
    In order to print the actual bytes I'm receiving would I just use the int read(byte[] b) or the byte readByte() methods from the dataInputStream class? Maybe just wrap it in a LoggingInputStream?
    You can find loads of examples from Google (LoggingInputStream).

  • Last packet not arriving after binary data transfer

    Hi folks,
    I have written a server app that receives a text header and a binary data block (e.g. an image). To read the text header I use a scanner "in" (to be more comfortable). Then after that I use the "bis" to get the binary data.
    That works so far. I get a header and binary block and then I want to send back a header and a binary data block to the client in the same way.
    My problem: In most of the cases (not always but mostly reproducable) delivering the result the last packet is not delivered to the client.
    These are my streams, readers and writers:
    bis = new BufferedInputStream(client.getInputStream());
    sr = new InputStreamReader(bis);
    in = new Scanner(sr);
    bus = new BufferedOutputStream(client.getOutputStream());
    response = new PrintWriter(bus);Here is the part of the file transfer back to the client:
    int copyBytes = 0;
    long copyTotal = 0;
    byte[] copyBuf = new byte[client.getSendBufferSize()];
    while ((copyBytes = cis.read(copyBuf)) != -1)
        bus.write(copyBuf, 0, copyBytes);
        copyTotal = copyTotal + copyBytes;
        System.out.println(copyBytes + "/" + copyTotal + " / " + fileSize);
        if (copyTotal >= fileSize)
            break;
    bus.flush();
    System.out.println("Finished copyStream");
    [...]On the client I have basically the same (the other way round - first send a header + binary block and then receive it):
    while ((bytesRead = bis.read(buffer)) != -1)
        fileStream.write(buffer, 0, bytesRead);
        bytesTotal = bytesTotal + bytesRead;
        System.out.println(bytesRead + "/" + bytesTotal + " / " + resultLength);
        if (bytesTotal >= resultLength)
            break;
    System.out.println("here i am");The output on the server is something like:
    Start copyStream
    46966/46966 / 46966
    Finished copyStreamOn the client it is like
    38950/38950 / 46966It never comes to the point where it should say "here i am" although on the server it writes that everything has been transferred.
    I found out that when I do a bus.close() at the server afterwards at the server then the last package arrives. But then I cannot continue using this connection, but I want to keep the connection waiting for additional header + binary block (or waiting for a "quit").
    I tested this on Windows and Linux (for the case there could be an OS specific strange behavior).
    What am I doing wrong? Wherever I search I don't find really different approaches to receive and send data. The only difference I can see from other samples is that I do use a reader and just when expecting binary data I use the underlying byte oriented stream. After flushing I go back reading from the "higher level" reader.
    The strange thing is that receiving the text header and binary block on the server works fine but when sending response back to the client it does not work.
    What I already tried:
    I tried nulling my readers while reading from the underlying byte oriented stream for the case they get confused with the binary data and if data is read from the underlying byte oriented stream (did that on server and client side). That did not help.
    I tried - as already mentioned - closing the bus stream - which closed my connection which I don't want but delivered the last package.
    I also tried using different type of binary stream. I used a TIF image, JPG image and finally tried also with a text content (treated as binary data) and only with the last text content the problem did not occur. But this should not make a difference when reading the byte stream.
    I am struggling now for two days with this problem and my last idea is trying to remove the readers in general and using just the binary oriented streams (which is more work for identifying the header lines which are plain text - anyway). But I have the doubt that this will not help because I already tried dropping them when transferring the binary block.
    Another link that I found is [http://rox-xmlrpc.sourceforge.net/niotut/index.html|http://rox-xmlrpc.sourceforge.net/niotut/index.html] - is it possible that I have to use nio for this? - But why can I then see plenty of examples without the use of nio what sense would it then make having the "normal" sockets without nio?

    jtahlborn wrote:
    yes, you generally cannot mix Readers and InputStreams. you mentioned that you were reading "byte by byte". but you weren't. you were reading "char by char" (with some more buffering). as mentioned by a previous poster, put a DataInputStream on top of your BufferedInputStream and use that exclusively.Thanks, that was the reason - now it works! Thanks a very lot!
    I have seen many samples and documentation where streams where taken to an upper level with readers with and without buffering. But I was not aware that I then have to use always exclusively the object on the upmost level. Reviewing some samples I can see that there is indeed no mixed usage.

  • Some binary data recoreded by labview cannot open by other program

    I have got some binary data which is recorded by a labview program. When I use some other program to open it (e.g. matlab, notepad, MS excel), it become some strange character, but when I use another labview retrieval program to open it, there is no problem. What happen?
    The original data is 32 bit data sets which are separated by a <CRLF>.
    The recording program (HS-Acquis.llb), the retrieval program (Advanced Viewer.llb), original data file (C1010710.480245) and the data file after retrieval (C1010710.480245.txt) was attached
    phy_mechanic
    Attachments:
    attachment.zip ‏1279 KB

    The data seems like it can only be read by LabVIEW because LabVIEW is set up to properly read the binary data and it is simple for a user to do.
    For matlab to read the data, it will have to be properly configured.
    FOPEN     -     Open a file
    FREAD     -     Binary file read
    FWRITE   -     Binary file write
    FTELL      -     Return the current file position
    FSEEK     -     Set file position indicator
    FCLOSE   -     Close a file
    An example is given from http://www.mathworks.com/support/tech-notes/1400/1​403.htm:
    %This m-file is a short example of how to read and write a binary file
    %in MATLAB using low level routines
    %write file
    fid = fopen('square_mat.bin','wb') %open file in binary write mode
    fwrite(fid, 'This is a square matrix', 'char'); %insert a header
    fwrite(fid, [1 2 3; 4 5 6; 7 8 9]', 'int32'); %write data to file
    fclose(fid); %close file
    %read in the same file
    fid = fopen('square_mat.bin','rb') %open file
    bintitle = fread(fid, 23, 'char'); %read in the header
    title = char(bintitle')
    data = fread(fid, [3 inf], 'int32') %read in the data
    data_tranpose = data' %must transpose data after reading in
    fclose(fid) %close file
     As you can see, the data type, size, array size, etc. has to be explicitly defined. In addition, as Dennis alluded to, LabVIEW stores binary data in Big-Endian format, wheras most windows applications use little endian. I assume matlab is one of those applications...but I am not a huge matlab developer. Google may have more information on that. You can use a typecast in matlab to convert big to little and little to big, however, so that may be a great place to start. Please see http://www.mathworks.com/access/helpdesk/help/tech​doc/ref/typecast.html
    Of course, our wonderful applications engineers at National Instruments have already done the above work for you and developed Knowledgebase 11SF83W0: How do I Transfer Data Between The MathWorks, Inc. MATLAB® Software Developm...which is easily searchable from ni.com knowledgebase category using 'matlab binary'
    Rob K
    Measurements Mechanical Engineer (C-Series, USB X-Series)
    National Instruments
    CompactRIO Developers Guide
    CompactRIO Out of the Box Video

  • How to add an image - binary data is present in data interface

    Hi,
    we have the requirement that an image (e.g. pie chart) has to be present in a print form. Based on the data, the image always differs. It is not possible to set an URL to get the image so we decided to store the binary data in the data interface.
    Is it possible to map the image control to the data structure?
    How can we store the binary content of an image in the data structure (please think about unicode and non-unicode ERP systems)?
    Do you have any idea?
    Thank you very much.
    Thomas

    Hi Thomas,
                     You need to create an image field and in the source choose 'graphic content ; give the name of the variable which has the binary data . and give the type as 'MIME/image'.

  • Writing binary data to ASP file from applet through URLConnection

    Hi Everybody,
    I am facing a proble with HttpURLConnection.I want to write some binary data from applet to an ASP file.The other end ASP file read this binary data and process , Here problem is I have opened URLConnection to the page and Created OutputStream and writing byte by Write() method But other end we are not getting bytes...we are not getting error too at java side..can any body help me..do we need to set any property to URLConnection...here I am giving sample code...
    OutputStream os;
    URL uConnect2;
    HttpURLConnection hucConnect2;
    uConnect2= new URL("http://webserver/vnc/sendtoserver.asp?"); hucConnect2=(HttpURLConnection)uConnect2.openConnection();
    hucConnect2.setDoOutput(true);
    hucConnect2.setRequestMethod("POST")
    os=new DataOutputStream(hucConnect2.getOutputStream());
    os.writeBytes("Hello");
    Thanks in Advance
    Madhav

    Do you remember to flush() and close() the stream?

Maybe you are looking for

  • MKT_ELEMENT_CREATE gives Dump during creation of Campaign Element

    Hi, I am trying to create campaign element through code and I am getting dump in the following class method. Class : CL_CRM_MKTPL_OL_MKTPROJECT Method : SET_ATTRIBUTES Line No : 15 ->> lr_header_item->get_attributes( EXPORTING iv_get_external_attribu

  • How To Get WINDOWS WEP PASSWORDS To Work

    Having problems getting simple simple simple WEP to work with your Airport despite knowing exactly what you are doing with WEP, everything looking fine, and with a network that otherwise has always worked fine before? Might be the case of password us

  • Sync a tasks or To-Do list - a basic workaround using Safari Bookmarks

    I resisted the iPhone when it came out but, being free with 02 in the UK, my resistance crumbled. I love it but am still flabbergasted by the lack of Tasks synchronisation. I had downloaded a simple 3rd party app, but this deleted all my tasks when i

  • My AMDS Isn't starting??

    Hello, I've had problems with my iPhone 6 (iOS 8.3) connecting to iTunes (12.1.2) . I have noticed that my AMDS hasn't started and whenever i click 'start' it comes up with this: 'The Apple Mobile Device Service service on Local Computer has started

  • Move text in pdf

    I lost the left column with the reduced text images and movement of images.  How do I get it back?