Unauthorized Exception in REST Client

Four Stars

Unauthorized Exception in REST Client

Hi All,
I'm using Talend ESB 6.3 version & trying to pull the data from HP ALM to MongoDB. 

In the my job, I've started from "tMongoDBConnection --> tRESTClient --> tExtractXMLField --> tXMLMap --> tMongoDBOutput".
In the REST Client component throwing Exception "HTTP 401 Unauthorized"
My Exception is :
Exception in component tRESTClient_1
javax.ws.rs.NotAuthorizedException: HTTP 401 Unauthorized
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.cxf.jaxrs.client.AbstractClient.convertToWebApplicationException(AbstractClient.java:507)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:895)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:863)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:426)
at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:609)
at local_project.restjob_0_1.RestJob.tRESTClient_1Process(RestJob.java:1764)
at local_project.restjob_0_1.RestJob.tMongoDBConnection_1Process(RestJob.java:411)
at local_project.restjob_0_1.RestJob.runJobInTOS(RestJob.java:2541)
disconnected
at local_project.restjob_0_1.RestJob.main(RestJob.java:2398).

How to resolve this issue?
Employee

Re: Unauthorized Exception in REST Client

Hi, it most likely means the target service is expecting a username and password, please set it in tRESTClient
Thirteen Stars

Re: Unauthorized Exception in REST Client

You need to check - what source REST service description, especial authorisation methods
did You test Your REST API call with Postman or similar tools?
-----------