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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Upload file to server that returns other code 200

In my Talend Data Integration job I need to upload a file (with multipart/form-data) to http server. Server in response returns http code other than 200 (for example 201, 202). 
I tried to use tFileFetch but this component only accepts responses with a code 200. 
Do you have any suggestion that I may use?

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

shong wrote:
unless you modify the source code of component.

I was not quite sure what you meant by modifying. I think you meant to write a custom component which source is copied from the  tFileFetch. So I resolved my problem in this way.

Anyway thank for your help!
 

View solution in original post

8 Replies
Anonymous
Not applicable
Author

Hi 
Which component do you use to upload a file? What is the return code you are getting now?
Anonymous
Not applicable
Author

Hi!
I tried to use tFileFetch to upload a file to a server.
But in generated code I found following lines:
if (status_tFileFetch_1 != org.apache.commons.httpclient.HttpStatus.SC_OK) {
   throw new java.lang.Exception("Method failed: " + method_tFileFetch_1.getStatusLine());
}

So I don't know what I should use to handle responses with codes like SC_CREATED (201) or SC_ACCEPTED (202).
Anonymous
Not applicable
Author

From the generated code, the returned status code is either SC_OK or Java exception. So, it will not return other status code unless you modify the source code of component.
Anonymous
Not applicable
Author

So is in Talend any component that during file upload can handle http status code other than SC_OK (200)?
Anonymous
Not applicable
Author

shong wrote:
unless you modify the source code of component.

I was not quite sure what you meant by modifying. I think you meant to write a custom component which source is copied from the  tFileFetch. So I resolved my problem in this way.

Anyway thank for your help!
 
Anonymous
Not applicable
Author

Great!   
Yes, copy the component and rename it to another one, modify the source code of component. 
Minal1
Contributor
Contributor

Hi ,

I am facing same issue, I want other status codes also to be accepted.

Please can you tell me steps to edit code in tFileFetch component and create new custom component.

 

Where do i need to edit and what ?

 

Please help me.

 

Anonymous
Not applicable
Author

@Minal

Refer to this documentation to learn about the component source file.

 

Regards

Shong