Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Send file to WebService

Hi all,
I'm trying to send a file to a Webservice, along with other parameters. For reading the file I use tFileDelimited with no separators, then pass the content to tWebServiceInput. I cannot figure out how to refer that content in the parameter list from tWebServiceInput for sending it to the WebServer.
Regards,
Radu
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi
Store the content into a global variable and get it on the parameter list of tWebserviceInput, for example:
tFileInputDelimited--main--tJavaRow
|
onsubjobok
|
tWebserviceInput--main--tLogRow
on tJavaRow:
globalMap.put("file_content", input_row.content) //content is the column name on tFileInputDelimited
on tWebserviceInput, set the value of parameters as below:
(String)globalMap.get("file_content")
Best regards
Shong

View solution in original post

13 Replies
Anonymous
Not applicable
Author

Hi
Store the content into a global variable and get it on the parameter list of tWebserviceInput, for example:
tFileInputDelimited--main--tJavaRow
|
onsubjobok
|
tWebserviceInput--main--tLogRow
on tJavaRow:
globalMap.put("file_content", input_row.content) //content is the column name on tFileInputDelimited
on tWebserviceInput, set the value of parameters as below:
(String)globalMap.get("file_content")
Best regards
Shong
Anonymous
Not applicable
Author

Hi Shong,
It worked. Thanks for your help!
Best Regards,
Radu
Anonymous
Not applicable
Author

Hi Shong,
It worked. Thanks for your help!
Best Regards,
Radu

Good news, thanks for your feedback!
Best regards
Shong
Anonymous
Not applicable
Author

Hi,
The file gets to the WebService in a wrong format. I guess it's not byte[] when send from WebServiceInput. I specified byte[] in FileInputDelimited's schema, and also changed the parameter expression in WebServiceInput to (byte[])globalMap.get("file_content"), but still, the received file is corrupted (is csv, xlsx,..).
Regards,
Radu
janhess
Creator II
Creator II

Should you not just specify it as a string?
Anonymous
Not applicable
Author

Should you not just specify it as a string?

I did that at first, but with similar results.
Inside the talend job it seems to be ok, it has the right length, but then the webservice receives it truncated at 6 characters.
janhess
Creator II
Creator II

Ah! I think you need base64 encoding. I had this problem sending binary data from a webservice. Had to encode it to send from webservice and decode on receipt.
Anonymous
Not applicable
Author

Ah! I think you need base64 encoding. I had this problem sending binary data from a webservice. Had to encode it to send from webservice and decode on receipt.

How can I encode it? Is it a componet which I have to use or encode in java?
I should mention that I'm not a java programmer.
Regards,
Radu
janhess
Creator II
Creator II

Use a tJavaRow for the encode/decode.
To enccode
String s = new sun.misc.BASE64Encoder().encode(input_row.Image);
//System.out.println("Text Decryted : " + s);
output_row.Image = s;
To deccode
byte[] buf = new sun.misc.BASE64Decoder().decodeBuffer(input_row.Image);
//System.out.println("Text Decryted : " + s);
output_row.Image = buf;