Pentaho

 View Only

 How to configure body field on rest client step

  • Pentaho
  • Kettle
  • Pentaho
  • Pentaho Data Integration PDI
luiz kava's profile image
luiz kava posted 08-04-2018 19:26

I'm using rest client step like belowerrojson

I don't know why but it doesn't work, the body generated for my java script works very well on postman.


#Pentaho
#PentahoDataIntegrationPDI
#Kettle
luiz kava's profile image
luiz kava

no one ? I'm thinking it doesn't work. Isn't possible call post webservices using json body

Brandon Jackson's profile image
Brandon Jackson

You can post JSON in the body.  You may also want to take a look at the HTTP Response just to see what the server had to say about the call result.

You are calling out to HTTPS, so to truely see what went to the destination server, you should install Charles Proxy (Man in the middle attack) and capture what PDI sent to see if it is exactly what postman sent.  I noticed extra square brackets on JSON and other things happen which can make the destination servers unhappy.  You can only see it either debugging PDI or be capturing the outgoing traffic.

Charles Web Debugging Proxy • HTTP Monitor / HTTP Proxy / HTTPS & SSL Proxy / Reverse Proxy

luiz kava's profile image
luiz kava

Thanks a lot Brandon Jackson,

There's no way to make REST CLIENT setp, It doesn't work as it should....

I think there is a bug on this setp, because it's a simple concept, just put json body into body field, just it...

I solve my problem using HTTP POST, like pic I attached, I just spent a long time with this "BUG STEP" called rest client.

httppost

Brandon Jackson's profile image
Brandon Jackson

There is another gotcha before you go.  Anytime you make a Java application connect via SSL to some other site, it is most important to make sure the JVM's certificate store has the SSL certificate for the site you are connecting to added in and trusted.  See the porticle utility and instructions for how Atlassian recommends doing that for their products.  It works the same for PDI and the Pentaho server itself.  Failing to do this could cause a red herring error where you think your call should succeed but it fails for some wrongly reported or generalized reason.

https://confluence.atlassian.com/kb/how-to-import-a-public-ssl-certificate-into-a-jvm-867025849.html

Please give it another go and let me know how it turns out.

Which exact version of PDI are you running?

luiz kava's profile image
luiz kava

Brandon Jackson I'm very grateful for your informations.

You said about Charles debug, It was really useful. I didn't know it, and how to check SSL certificate as well.

 

BTW I'm using version 8.0.

 

 

John Craig's profile image
John Craig

There is a quite different option, if you continue to have trouble with the REST call step (although it sounds like you're on the right track now): we had a case where we had no luck with either the REST Call or the HTTP Client steps (and Pentaho support was unable to figure out how to make either of those steps work). Our eventual solution was to make a call to cURL via a shell step (with the cURL parameters created by prior steps). Not quite as elegant as we'd hoped for, but it worked great.

luiz kava's profile image
luiz kava

I solved this issue using Http Post, it worked very well, thanks everyone for your help... regards

Djibril Dione's profile image
Djibril Dione

Hi Luiz,

did you use JSON or XML in the Request field? am having a challenge of Pushing millions of records using API Post (it takes the whole day running) and I would like to test the HTTP Post performance compared to REST Client which seems very slow.

when I run the transformation using HTTP Post in JSON the server does not return any results.

pastedimage_1

pastedimage_1

luiz kava's profile image
luiz kava

Hi.

I used Json in my request.

I think both, rest client and rest client don't have high perfromance, in my case I work with few reccords, but even so take several seconds.

Jose Marfil's profile image
Jose Marfil

In my case, up to version 9.4 of PDI, the issue with the 'REST Client' is that it fails to calculate content-length when the body field includes some accented letters like á or ñ.