
Contributor
2014-08-06
06:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Web service : send a csv file in response
Hi everybody,
I would like to design a Web service that can send a user un file (.csv or .txt) containing some rows extracted from a table.
I want to call this Web service from a browser and I want to be able to give some parameters in the URL.
For instance, I want to send a file containing all the countries with a name starting by a letter.
The URL could be http://localhost:8040/listCountries?letter=F
For designing this Web service, which components can I use ?
I though to this orchestration :
tRESTRequest --tFlowToIterate--tMySQLInput--tXMLMap--tRESTResponse but I have some questions :
1) How can I get the parameter 'letter' given in the URL ?
2) Once I have executed the request, how can I set the tRESTResponse to send a file ?
Any help would be appreciated.
Thanks
I would like to design a Web service that can send a user un file (.csv or .txt) containing some rows extracted from a table.
I want to call this Web service from a browser and I want to be able to give some parameters in the URL.
For instance, I want to send a file containing all the countries with a name starting by a letter.
The URL could be http://localhost:8040/listCountries?letter=F
For designing this Web service, which components can I use ?
I though to this orchestration :
tRESTRequest --tFlowToIterate--tMySQLInput--tXMLMap--tRESTResponse but I have some questions :
1) How can I get the parameter 'letter' given in the URL ?
2) Once I have executed the request, how can I set the tRESTResponse to send a file ?
Any help would be appreciated.
Thanks
327 Views
4 Replies

Contributor
2014-08-06
10:29 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have done this :
tRESTRequest--(main)-->tFlowToIterate--(iterate)--tJava--(onComponentOK)--tFixedFlowInput--(main)--tXMLMap--(main)--tRESTResponse
In the tJava, I have hardcoded some lines in order to put the file in a globalMap as a byte array :
String filePath = "C:/eula.1036.txt";
byte[] t_byte = (byte[]) routines.SynotisFileUtils.getByteArrayFromFile(filePath);
globalMap.put("mon_fichier", (byte[]) t_byte);
In the tRESTResponse, I have set the "Content-type" ("text/plain") and the "Content-disposition" ("attachment").
It seems to work but the file is empty...
Any idea ?
I have done this :
tRESTRequest--(main)-->tFlowToIterate--(iterate)--tJava--(onComponentOK)--tFixedFlowInput--(main)--tXMLMap--(main)--tRESTResponse
In the tJava, I have hardcoded some lines in order to put the file in a globalMap as a byte array :
String filePath = "C:/eula.1036.txt";
byte[] t_byte = (byte[]) routines.SynotisFileUtils.getByteArrayFromFile(filePath);
globalMap.put("mon_fichier", (byte[]) t_byte);
In the tRESTResponse, I have set the "Content-type" ("text/plain") and the "Content-disposition" ("attachment").
It seems to work but the file is empty...
Any idea ?
327 Views

Contributor
2014-08-12
11:20 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Any idea ?
327 Views

Specialist III
2014-09-04
12:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4FMPci <a href="">gyzqdbdcujdu</a>, osbeugmytpcu, fgnyltdbsoen,
327 Views

Contributor
2014-09-24
05:48 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry ?
Still can't send my result in the response...
Still can't send my result in the response...
327 Views
