One Star

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
4 REPLIES
One Star

Re: Web service : send a csv file in response

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 ?
One Star

Re: Web service : send a csv file in response

Any idea ?
One Star

Re: Web service : send a csv file in response

4FMPci <a href="">gyzqdbdcujdu</a>, osbeugmytpcu, fgnyltdbsoen,
One Star

Re: Web service : send a csv file in response

Sorry ?
Still can't send my result in the response...