- Praveen Rajarao
- PowerBuilder
- Tuesday, 6 August 2019 06:57 PM UTC
Hello,
I am looking to set a TimeOut for my REST calls from PB12.5.2. Below is my code:
loo_xmlhttp = CREATE oleobject
loo_xmlhttp.ConnectToNewObject("Msxml2.ServerXMLHTTP.6.0")
loo_xmlhttp.setTimeouts(100,100,100,100)
// invoke POST method for REST web service
loo_xmlhttp.open (astr_rs.in_method_type, is_url_send, false)
// building HTTP request headers
lblb_args = blob(astr_rs.in_arg_data)
ll_length = Len(lblb_args)
loo_xmlhttp.setRequestHeader("Content-Type", is_headers_content_type)
loo_xmlhttp.setRequestHeader("Content-Length", String( ll_length ))
loo_xmlhttp.setRequestHeader("Authorization", "Basic " + is_headers_authorization)
loo_xmlhttp.setRequestHeader("If-Modified-Since", string(today()))
loo_xmlhttp.setRequestHeader("Accept", 'text/xml')
// send request XML
loo_xmlhttp.send(astr_rs.in_arg_data)
// response from the service
ls_status_text = loo_xmlhttp.StatusText
ll_status_code = loo_xmlhttp.Status
ls_response_text = loo_xmlhttp.ResponseText
The highlighted line of code is where I am setting a really low timeout interval (200ms).
But I do not see that working. The service is taking close to 10secs to return and the Send function waits for that time.
How do I achieve it? My aim is to set a timeout and close connection and return control to the application.
Thanks
Praveen
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.