1. Menna Pablo Javier
  2. PowerBuilder
  3. Friday, 25 August 2023 14:50 PM UTC
Hi,

I have a problem when executing the function setrequestheaders() to which the following string is passed as a parameter: "content-type: text/xml; charset=utf-8" This call sometimes throws me the following error: "Bad runtime function reference at line 20 in function http_function() of object uo_object." which corresponds to the line: li_res = http.setrequestheaders("content-type: text/xml; charset=utf-8") The inconvenience only happens from the compiled application, if it is run from the IDE it works correctly. Any idea what might be going wrong?

Thanks
John Fauss Accepted Answer Pending Moderation
  1. Friday, 25 August 2023 15:48 PM UTC
  2. PowerBuilder
  3. # 1

What version, release, build of PowerBuilder? Is the app compiled as 32-bit or 64-bit? What version/flavor of Windows is the compiled app running on?

Have you deployed the runtime files that provide the HTTPClient functionality?

Best regards, John

Comment
  1. Menna Pablo Javier
  2. Friday, 25 August 2023 17:28 PM UTC
Hi John.

We are using:

IDE PB: Version 2022 R2 Build 2819,

Runtime version 2022 Build 2819.

The application is compiled in 32 bits on Windows Server 2012. Then, we run the application in Windows 10 and 11.

The libraries pbhttpclient.dll, pbjson.dll and pbrestclient.dll are from runtime 22.1.0.2819



Regards
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Friday, 25 August 2023 18:05 PM UTC
  2. PowerBuilder
  3. # 2

Use SetRequestHeader, not SetRequestHeaders.

 

li_res = lnv_http.SetRequestHeader("Content-Type", "text/xml; charset=utf-8")

 

Make sure the data being sent is actually UTF-8, that is not the default.

 

li_res = lnv_http.SendRequest("POST", ls_ServerURL, ls_XMLdata, EncodingUTF8!)

Comment
  1. Menna Pablo Javier
  2. Friday, 25 August 2023 18:40 PM UTC
Hi Roland.

I have already tried using SetRequestHeader instead of SetRequestHeaders and the application breaks at that point. And this is before we get to the SendRequest() function.



Thanks
  1. Helpful
There are no comments made yet.
Menna Pablo Javier Accepted Answer Pending Moderation
  1. Tuesday, 29 August 2023 11:12 AM UTC
  2. PowerBuilder
  3. # 3

Hi,

John, Roland, I appreciate the answers you have given us.
What we did to fix it was run the Runtime Packager PB2022R2, create an .msi, take the files generated by the installation and verify that these are taken into account when running our application. And so it worked correctly.


Regards!

Comment
  1. John Fauss
  2. Tuesday, 29 August 2023 12:20 PM UTC
That is great news, Menna! Thank you for sharing the solution. Would you please take a moment and mark this issue as resolved? Many thanks!
  1. Helpful
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.