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
Second, I tried the WinHTTP for the GetURL. It does not return me the complete XML that is returned by the service. The PostURL works great. WinHTTP would be my first choice if I could do GET calls.
The GetURL method returns only tags which have values I think. So the very first tag with the namespace is not returned which I definitely need. In essence, I would like the GetURL to return similar to how the PostURL returns me the complete URL.
Hey, thanks for all the quick responses. Really appreciate your time.