How to handle custom HTTP response code in tFileFetch

Six Stars

How to handle custom HTTP response code in tFileFetch

I am using tFileFetch to POST files using REST service. In case of successful post, the service returns 201 http response code. However, tFileFetch considers only 200 as successful post (I checked the java code behind this component) and so it throws an exception as shown below even it successfully post the message (file).

 

[statistics] connecting to socket on port 3802
[statistics] connected
[INFO ]: org.apache.commons.httpclient.auth.AuthChallengeProcessor - basic authentication scheme selected
There isContinue_tFileFetch_1 an exception on: http://xxxxxx:4012/api/products/pcproducts
java.lang.Exception: Method failed: HTTP/1.1 201 

 

How can I handle this situation?  so that the job will not fail and returns the response gracefully. 

 

I need the response message from tFileFetch, so that I can check the response code and do things accordingly. 

 

In the past I used tFileFetch for file upload without any problem (in those cases the services return 200 in case of successful post)

 

Thanks for your help.

Seven Stars

Re: How to handle custom HTTP response code in tFileFetch

Have you tried using something like tRestClient?  That component's schema will return the status code, but it also shouldn't fail on a 201.  I tested w/ this endpoint https://httpstat.us/201 using a POST request.

Six Stars

Re: How to handle custom HTTP response code in tFileFetch

Thanks evansdar.

It appears to be I need to have the OSGi bundle to use tRESTClient. I will try this.