Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Community
I want to call a webservice with tRestClient using json file which content login and password to authentify.
I have already testing it with Restlet Client and it works,further more i'm tryin to apply a lot of solutions that i found in community but without succes.
I get this error in Talend(v7.0.1) :
Exception in component tRESTClient_2 (trestcleint)
javax.ws.rs.WebApplicationException: HTTP 400 Bad Request
at local_project.trestcleint_0_1.trestcleint.tFileInputJSON_1Process(trestcleint.java:938)
at local_project.trestcleint_0_1.trestcleint.runJobInTOS(trestcleint.java:1272)
at local_project.trestcleint_0_1.trestcleint.main(trestcleint.java:1121)
[statistics] disconnected
Anybody can help me please?
Thank's in advance!
Hi @subhadip13
i found the solution,i added a tmap in which I added a String variable that contains the login and password in this forme : new String("{ \"login\":\"test\",\"motPasse\":\"admin\"}").
thanks for your help.
Hi @shima
Please check the Web URL in any web browser as it seems as an incorrect url.
In addition to that please check if you have any authentication, or if you require any proxy to connect to the API.
Thanks and Regards,
Subhadip
Thanks for your response,
i have testing this url in RestLet Client(REST API TESTING) and it works using the authentification,
In Talend i put the login and password in a json file,is it the right way to authentify to webservice.?
Hi @shima
You have to check the use Authentication checkbox and provide the user name and password.
Alternatively you can store those details in context and use them.
Thanks and Regards,
Subhadip
hi @subhadip13
I had already tried to check the authentication with method GET but it still give an error(javax.ws.rs.NotAllowedException: HTTP 405 Method Not Allowed),and when i tryin with method post it give me the first error HTTP 400.
is there another way to pass login and password to Trestclient.
Thanks
Hi @shima ,
Unfortunately, you can only pass your authentication in tRestClient as context or by hardcoded value.
Please check if you require any kind of proxy to connect to the API.
Thanks and Regards,
Subhadip
hi @subhadip13 ,
i have checked and there isn't no proxy to connect to my api.
when i tested it in postman it's working with success. it's weird!!
Thanks
Hi @subhadip13
i found the solution,i added a tmap in which I added a String variable that contains the login and password in this forme : new String("{ \"login\":\"test\",\"motPasse\":\"admin\"}").
thanks for your help.
Hello,
I am also working in API REST.Could you please post the screen captures ,how you did in your job that could be useful for me .I got stuck with this and I couldn't progress on it.
Thanks in advance for your reply
See https://community.talend.com/s/feed/0D73p0000047jYoCAI