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
Similar Messages
-
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. -
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,
YusufThanks 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 -
How to write xml data to a file
Hi all,
We have a requirement of writing the xml data into a file in given directory in the server. Generating the xml data using the sql query below.
SELECT XMLELEMENT ("ROW",
XMLELEMENT ("CELL", xmlattributes ('EBIZCZMDL_01' AS "colname"), inventory_item_id),
XMLELEMENT ("CELL", xmlattributes ('EBIZFFMT_01' AS "COLNAME"), attribute29),
XMLELEMENT ("CELL", xmlattributes ('COMMON' AS "COLNAME"),inventory_item_id || '' || attribute29 || 'ITM')
AS "RESULT") "XMLDATA"
FROM apps.mtl_system_items_b
When we try to write the the data from this query to a file using UTL_FILE.put_line, the script gives the error
PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
If somebody can help us pls.......
Thanks in advanceHi Odie,
We are looking at the xml data to be like the below:
- <xref xmlns="http://xmlns.oracle.com/xref">
- <table name="NAPP_ITEM_ITEMID">
- <columns>
<column name="EBIZFFMT_01" />
<column name="COMMON" />
<column name="EBIZQOT_01" />
<column name="EBIZCZMDL_01" />
<column name="EBIZCZGOLD_01" />
</columns>
- <rows>
- <row>
<cell colName="EBIZFFMT_01">154</cell>
<cell colName="COMMON">154811809990111362727</cell>
<cell colName="EBIZQOT_01">81</cell>
<cell colName="EBIZCZMDL_01">91</cell>
<cell colName="EBIZCZGOLD_01">991</cell>
</row>
- <row>
<cell colName="EBIZFFMT_01">180</cell>
<cell colName="COMMON">180811809990111362727</cell>
<cell colName="EBIZQOT_01">871</cell>
<cell colName="EBIZCZMDL_01">731</cell>
<cell colName="EBIZCZGOLD_01">341</cell>
</row>
</rows>
</table>
</xref>
We have managed half way trying to get the structure. As we are new to this XML Programming.
The call to dbms_xslprocessor.clob2file is within the cursor loop for the given SQL.
DECLARE
l_file_name VARCHAR2 (30);
l_file_path VARCHAR2 (200);
CURSOR xml_cur
IS
SELECT XMLELEMENT
("ROW",
XMLELEMENT ("CELL",
xmlattributes ('EBIZCZMDL_01' AS "colname"),
inventory_item_id
XMLELEMENT ("CELL",
xmlattributes ('EBIZFFMT_01' AS "COLNAME"),
attribute29
XMLELEMENT ("CELL",
xmlattributes ('COMMON' AS "COLNAME"),
inventory_item_id || '' || attribute29 || 'ITM'
) AS "RESULT"
) "XMLDATA"
FROM apps.mtl_system_items_b
WHERE attribute29 IS NOT NULL;
BEGIN
l_file_path := '/usr/tmp';
l_file_name := 'TEST_XREF4.xml';
FOR xml_rec IN xml_cur
LOOP
dbms_xslprocessor.clob2file(xml_rec.XMLDATA, l_file_path, l_file_name, nls_charset_id('UTF8') );
END LOOP;
END;
Please see the above code snippet and help us if we are doing something wrong.
Thank you -
How to read and write a data from extrenal file
Hi..
How to read and write a data from extrenal file using Pl/sql?
Is it possible from Dyanamic Sql or any other way?
Reagards
Rajuutl_file
Re: How to Create text(dat) file.
Message was edited by:
jeneesh -
How to Convert Binary Data in Binary File
hi,
my telecom client puts a binary file which is asn.1 encoded with BER.
how to handle binary data in java.
how to convert binary to hexa to ascii format
how to convert binary to octet to ascii format
please help me in this.
regards,
s.mohamed asifYou don't need to convert the data.
Only you can do is print it in that formats, like it:
public static String byteArrayToHex(byte[] b) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < b.length; i++)
sb.append(Integer.toHexString(b&255) + " ");
return sb.toString();
take a look at this
http://java.sun.com/docs/books/tutorial/essential/io/ -
Example using setcontenttype to write binary data?
Hi there,
I'm having trouble getting my jsp to read a binary file and send the response to an http client.
I'm not sure what it could be between the getWriter, getOutputStream, setcontenttype, and other methods involved.
Can anyone provide and/or point me to a simple example where a binary file is opened, read, and the contents sent back to a web-browser?
Thanks!First, I would not recommend using JSP, but use servlets instead. If you have any newlines in the page like after <%@ page directives, you are can't write binary data. So you have to make all your page directives and everything have no newlines, making it ugly to read.
Second, use getOutputStream() to write to...
request.setContentType("application/octet-stream"); // or actual file mime type
request.setHeader("Content-Length", theFileSizeInBytes);
request.setHeader("Content-Disposition", "attachment; filename=" + theFileName); // if should do save as
OutputStream os = response.getOutputStream();
... -
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?
ThanksHi 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 writing the data into the file at the same frequency of data acquisition using myRIO
Hi everyone,
I have a question regarding data acquisition fequency and data recording frequency of myRIO. Hope you guys can help me out.
Basically, I want to acquire voltage input at analog input 0 at the frequency of 1kHz and then write the data into a file (tdms format).
However, I always found there were only 55 or 56 data points recorded every second in the data file (see the excel sheet).
To confirm my data acquisition was performed at the correct frequency, I added a small function in the main loop to indicate the time spent between two acquisition events.
To my surprise, the period of data acquistion is correct (1ms or 1kHz) but there are only 55 or 56 data point per second recorded in the data file.
How can I record every data point acquired by the analog input?
Thank you!
P.S. I am very new to myRIO. How can I manually set the system time for myRIO? The default time of my myRIO is wrong.
Best,
Tengyang
Attachments:
test result.xlsx 16 KB
Main with timed loop.vi 122 KB
test result.xlsx 16 KBHave a look at the Jakarta POI project, they have a Java API for creating Word documents.
http://jakarta.apache.org/poi/hwpf/index.html -
Write the data into a file in 10 ms interval within 10 sec
Hi,
I'm trying to write the data into a file when I press a OK button and the data should write in a file every 10ms interval. After pressing the OK button the process will stop after 10 sec.
I've attached my VI.
Problem is that I'm getting the result every ms. How can I get the data every 10ms? So it'll come 1000 data within 10 sec.
For other calculations purpose I'm using Amplitude and Level Measurements block to get the mean DC voltage, so when I change the Samples to Read and Rates, the process is getting stuck.
Any kind of suggestion is appreciable.
Thanks,
Chotan
Attachments:
DAQ_Time_Checking_For10s_02.vi 131 KBSee example attached, if needed
Nghtcwrlr
********************Kudos are alwayzz Welcome !! ******************
Attachments:
Example.vi 36 KB -
How to read the data from Excel file and Store in XML file using java
Hi All,
I got a problem with Excel file.
My problem is how to read the data from Excel file and Store in XML file using java excel api.
For getting the data from Excel file what are all the steps i need to follow to get the correct result.
Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
Thanks & Regards,
Sreenu,
[email protected],
india,If you want someone to do your work, please have the courtesy to provide payment.
http://www.rentacoder.com -
How to Load the data from excel file(Extension is .CSV) into the temp.table
Hi
How to Load the data from excel file(Extension is .CSV) into the temporary table of oracle in Forms11g.
My Forms Version is - Forms [64 Bit] Version 11.1.2.0.0 (Production)
Kindly Suggest the Solution.
Regards,
SachinHello Sachin,
You can use the following metalink note:How to Read Data from an EXCEL Spreadsheet into a Form Using Webutil Client_OLE2 (Doc ID 813535.1) and modify it a little bit.
Instead of copy values into forms you can save them in your temporary table.
Kind regards,
Alex
If someone's helpful or correct please mark it accordingly. -
How to load the data from .csv file to oracle table???
Hi,
I am using oracle 10g , plsql developer. Can anyone help me in how to load the data from .csv file to oracle table. The table is already created with the required columns. The .csv file is having about 10lakh records. Is it possible to load 10lakh records. can any one please tell me how to proceed.
Thanks in advance981145 wrote:
Can you tell more about sql * loader??? how to know that utility is available for me or not??? I am using oracle 10g database and plsql developer???SQL*Loader is part of the Oracle client. If you have a developer installation you should normally have it on your client.
the command is
sqlldrType it and see if you have it installed.
Have a look also at the FAQ link posted by Marwin.
There are plenty of examples also on the web.
Regards.
Al -
How to load the data from excel file into temprory table in Forms 11g?
Hi
How to Load the data from excel file(Extension is .CSV) into the temporary table of oracle in Forms11g.
My Forms Version is - Forms [64 Bit] Version 11.1.2.0.0 (Production)
Kindly Suggest the Solution.
Regards,
SachinDeclare
v_full_filename varchar2(500);
v_server_path varchar2(2000);
v_separator VARCHAR2(1);
v_filename VARCHAR2(400);
filename VARCHAR2 (100);
v_stop_load varchar2 (2000);
v_rec_error_log varchar2(4000);
v_error_log varchar2(4000);
ctr NUMBER (12);
cols NUMBER (2);
btn number;
RES BOOLEAN;
application ole2.obj_type;
workbooks ole2.obj_type;
workbook ole2.obj_type;
worksheets ole2.obj_type;
worksheet ole2.obj_type;
cell ole2.obj_type;
cellType ole2.OBJ_TYPE;
args ole2.obj_type;
PROCEDURE olearg
IS
args ole2.obj_type;
BEGIN
args := ole2.create_arglist;
ole2.add_arg (args, ctr);
ole2.add_arg (args, cols);
cell := ole2.get_obj_property (worksheet, 'Cells', args);
ole2.destroy_arglist (args);
END;
BEGIN
v_full_filename := client_get_file_name(directory_name => null
,file_name => null
,file_filter => 'Excel files (*.xls)|*.xls|'
||'Excel files (*.xlsx)|*.xlsx|'
,message => 'Choose Excel file'
,dialog_type => null
,select_file => null
If v_full_filename is not null Then
v_separator := WEBUTIL_CLIENTINFO.Get_file_Separator ;
v_filename := v_separator||v_full_filename ;
:LOAD_FILE_NAME := substr(v_filename,instr(v_filename,v_separator,-1) + 1);
RES := Webutil_File_Transfer.Client_To_AS(v_full_filename,"server_path"||substr(v_filename,instr(v_filename,v_separator,-1) + 1));
--Begin load data from EXCEL
BEGIN
filename := v_server_path||substr(v_filename,instr(v_filename,v_separator,-1) + 1); -- to pick the file
application := ole2.create_obj ('Excel.Application');
ole2.set_property (application, 'Visible', 'false');
workbooks := ole2.get_obj_property (application, 'Workbooks');
args := ole2.create_arglist;
ole2.add_arg (args, filename); -- file path and name
workbook := ole2.get_obj_property(workbooks,'Open',args);
ole2.destroy_arglist (args);
args := ole2.create_arglist;
ole2.add_arg (args, 'Sheet1');
worksheet := ole2.get_obj_property (workbook, 'Worksheets', args);
ole2.destroy_arglist (args);
ctr := 2; --row number
cols := 1; -- column number
go_block('xxx');
FIRST_RECORD;
LOOP
--Column 1 VALUE --------------------------------------------------------------------
olearg;
v_stop_load := ole2.get_char_property (cell, 'Text'); --cell value of the argument
:item1 := v_stop_load;
cols := cols + 1;
--Column 2 VALUE --------------------------------------------------------------------
olearg;
:item2 := ole2.get_char_property (cell, 'Text'); --cell value of the argument
cols := cols + 1;
--<and so on>
ole2.invoke (application, 'Quit');
ole2.RELEASE_OBJ (cell);
ole2.RELEASE_OBJ (worksheet);
ole2.RELEASE_OBJ (worksheets);
ole2.RELEASE_OBJ (workbook);
ole2.RELEASE_OBJ (workbooks);
ole2.RELEASE_OBJ (application);
END;
--End load data from EXCELPlease mark it as answered if you helped. -
How to load the data from excel file into table in oracle using UTL_FI
How to load the data from excel file into table in oracle
and from table to excel file
using UTL_FILE package
Please give me some exampleThis is something i tried in oracle apex
http://avdeo.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
Regards,
CKLP
Maybe you are looking for
-
Including 4:3 material in a 16:9 environment
Hi, I'm a relative Premiere Elements 9 newbie and I need to combine 4:3 material with content shot in 16:9. The 4:3 content is historical public domain footage downloaded in MPEG-2 format. My 16:9 material is in MPEG-4 format, 720x480. I've decided t
-
Hello ! I'm using Lenovo G560 laptop i5 windows 7 32 bit. For the past year I had the ability to press the sleep \ stand by button in my windows 7 OS, but somehow for some reason it's not pressable anymore so I can't make the laptop go to sleep and
-
Trex search failed, how to find the problematic property?
Hello, I've created an index that runs over a repository which contains documents with lots of customised attributes. When I run a search through this index I get: "Error during search occurred - com.sapportals.wcm.WcmException: attribute value is no
-
Fill a field at the btadmini context node
Hi experts Iu2019ve to fill the field ZZCURVAMAT at the btadmini context node when I put a product in the order item. Iu2019m trying to fill that field in the get_ordered_prod method with the code below: CALL METHOD lr_entity->if_bol_bo_property_acce
-
Php connect to oracle 8i,it occur ORA-12154
Warning: ociopen_server: Error while trying to retrieve text for error ORA-12154 in /SOHU/community/bbs/html/inc/dbcon.php3 on line 4