1. JOSE WILLIAM ROMERO OLIVOS
  2. PowerBuilder
  3. Thursday, 13 July 2023 21:19 PM UTC
Best regard

I would like to know if with the RESTClient object it is possible to consume a REST webservice, passing it a json.

With the SOAP Ui program, I perform a test, but I can't find how to pass the ENDPOINT parameter to it.

How could I consume the webservices by passing the parameters that I attached in the image?

Does anyone have an example?

Thank you so much
Attachments (1)
JOSE WILLIAM ROMERO OLIVOS Accepted Answer Pending Moderation
  1. Friday, 14 July 2023 14:44 PM UTC
  2. PowerBuilder
  3. # 1
Fixed.

It is really very easy to consume a REST webservice with the Powerbuilder 2022 RESTClient object.

In my case, since I am going to pass a json to it, I must specify it in the header.

I validate the json string with JsonParser

ls_Error = lnv_JsonParser.LoadString(ls_Json)

if Len(ls_Error) > 0 then
MessageBox("Error", "Formato JSON no válido",stopsign!)
return
end if
I send the header
lo_rest.setrequestheader("Content-Type","application/json; charset=utf-8")
Then the request

liSendReturn = lo_rest.sendpostrequest(ls_url,ls_json,ls_Responsebody)

 

And ready. I share my solution.

Thank you so much

 

Comment
  1. Miguel Leeuwe
  2. Friday, 14 July 2023 14:46 PM UTC
thanks for sharing and please mark as resolved.
  1. Helpful
There are no comments made yet.
JOSE WILLIAM ROMERO OLIVOS Accepted Answer Pending Moderation
  1. Thursday, 13 July 2023 23:03 PM UTC
  2. PowerBuilder
  3. # 2
Thanks for the reply. I have been reading the documentation. I tried this way, but it gives me error -35

Any idea what I have wrong in the code?

 

lo_rest.setrequestheader("","POST /api/ContribuyenteFacturacion/ConsultarNumeraciones HTTP/1.1")
lo_rest.setrequestheader("Accept-Encoding","gzip,deflate")
lo_rest.setrequestheader("Content-Type","application/json; charset=utf-8")
lo_rest.setrequestheader("Content-Length","170")
lo_rest.setrequestheader("Host","gestioncontribuyentesrest.thefactoryhka.com.co")

liSendReturn = lo_rest.sendpostrequest(ls_url,ls_json,ls_Responsebody)

-35 -- TLS 1.3 error. The server does not support TLS 1.3.

Comment
  1. Daryl Foster
  2. Friday, 14 July 2023 00:30 AM UTC
If that return code and error message are accurate it would seem to indicate that the server you are sending to doesn't support TLS 1.3.



That should be controlled by the SecureProtocol property which should default to 1, but have you changed it?



https://docs.appeon.com/pb2022/objects_and_controls/ch03s266s01.html
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 13 July 2023 22:12 PM UTC
  2. PowerBuilder
  3. # 3

Hi,

Please do a search on this Q&A with the word "soap" and you'll find many examples. Or click on this link https://community.appeon.com/index.php/qna/q-a/search/c29hcA==

regards

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.