Bug 4521

SendRequest("POST", as_url, as_json_input) returns -6 15 September, 2020

Yuri Denshchik
29 April, 2020
Product: PowerBuilder Category: PowerScript
Version: 2019 R2 Build:
Classification: Publishing: Public
Priority: P3
Status: Closed Reason: NO RESPONSE
armando herrera @Appeon 15 September, 2020
Hi Yuri,

Based on our policy we have made 3 different attempts to contact you and determine if this ticket has been solved unfortunately, we did not get any response and we proceed to close it. 

If you consider this issue is still not fixed please, contact us.

armando herrera @Appeon 03 September, 2020
Hi Yuri, 

We have been trying to keep in touch with you to find out about the resolution of this issue, we would like to continue with our support but without more information, we are in the need to close it in the next 3 working days, according to our internal help support policy but please remember you can always open a new ticket.   

armando herrera @Appeon 04 August, 2020
Hi Yuri, 

This ticket was stopped due to a required test case and we need to collect more information about it, please note you can also send us a set of screenshots or a small video showing the case so that we can try to collect the information we require to move on.

Thanks for your understanding!

Mark Lee @Appeon 29 July, 2020
Hi Yuri,

Thanks for your feedback.
The issue you reported is not a consistently reproducible issue for all customers.  
So for such issue, we will require that you provide a test case in order for us to be able to help you.  
If for some reason you cannot provide a test case we will need to close this ticket.  
Thank you for your cooperation.

Mark Lee
Yuri Denshchik 28 July, 2020
the response provided was not helpful
armando herrera @Appeon 27 July, 2020
Hi Yuri, 

I'm checking if the response provided to you was helpful enough to resolve
your case. If so, can we proceed to close this ticket?.
Otherwise, do let us know if we can provide you with any further assistance.

Please keep in mind, that you are always welcome to open another ticket in case you need it.

armando herrera @Appeon 15 July, 2020
Hi Yuri,

It has been a while since we heard from you!. 

Are you still facing this problem?. 
Is there anything else we can do to help with this case? 

Mark Lee @Appeon 09 May, 2020
Hi Yuri,

Thanks for your feedback.    
I have tested several sample test cases similar to the sample code you provided, but I still cannot reproduce it.
I also checked our demo example case of the HttpClient in the PB Help and got the same result as well.
Do you have other server links that can be used to confirm this issue?
I think this issue may be related to your server environment or settings, but I can't confirm that.

Mark Lee
Yuri Denshchik 06 May, 2020
I can replicate the issue on 64 and 32 bit
Yuri Denshchik 06 May, 2020
HttpClient lnv_HttpClient

lnv_HttpClient = create HttpClient
lnv_HttpClient.SetRequestHeader("Content-Type", "application/json;charset=UTF-8")
lnv_HttpClient.SetRequestHeader("Authorization", "Basic " + is_basicEncodedAuthorization)
lnv_HttpClient.SetRequestHeader("Keep-Alive", "timeout=0")
lnv_HttpClient.SetRequestHeader("Accept", "*/*")
lnv_HttpClient.Timeout = ii_timeout

// Construct a POST request (supports all headers)
lnv_HttpClient.SetRequestHeader("Content-Type", "application/json;charset=UTF-8")

// Send request using POST method (to add the string data to the body and set to the Content-Length header)
//as_json_input = {"stepId":"4786","cmd":"cmd /c echo %random%"}
li_ret = lnv_HttpClient.SendRequest("POST", as_url, as_json_input)
Mark Lee @Appeon 06 May, 2020
Hi Yuri,

Thanks for the confirmation!
1. For your case, I think this is a bug. However, I built a small test case but can't reproduce it.

2. Can you provide a reproducible sample test case (with PBT / PBL) for us to reproduce it?
Thanks in advance.

3. Please let us know which version of the OS you are using (for example, 32-bit Windows 7 English).

Mark Lee
Yuri Denshchik 04 May, 2020
If I add  EncodingUTF8!  to SendRequest()  then it works. 
The doc states, "... data will be encoded in the charset specified in the Content-Type request header"
I have line 
luo_httpClient.SetRequestHeader("Content-Type", "application/json;charset=UTF-8")
So I'd expect to encode data in UTF-8 . 
The same code worked just fine in PB2017
Yuri Denshchik 04 May, 2020
server supports the encoding charset as UTF-8, confirmed.
Mark Lee @Appeon 29 April, 2020
Hi Yuri,

Thanks for reporting this problem.
Please confirm whether your server supports the encoding charset as UTF-8.
If not, please use another syntax of sendrequest function and specify the charset value which your server supports and then test it again:
objectname.SendRequest ( methodName, urlName, string data, encodingType )

You can also refer to the following link for detail.
If it still can’t resolve your problem, please provide a sample test case for us to reproduce it. Thanks in advance.

Mark Lee
Yuri Denshchik 29 April, 2020
HttpClient SendRequest("POST", as_url, as_jsonInput) returns -6 in PB2019 R2
as_url is HTTP-based URL
as_jsonInput = {"objectClasses" : ["U"], "objectTypes" : ["2001"], "fileNames" : ["linnea.cbl"], "dbCode" : "P856UDOR"}

The same code works just fine in PB2017R3
Windows 10
Database Type:
Database Version: