I have the below code to call PostURL function of the n_cst_internet object in powerbuilder.
ll_status_code= iinet_base.PostURL (a_url, lblb_args, ls_headers, data)
IF ll_status_code = -1 Then
ls_status_text = "There was an Error accessing Rest Service - General error"
ElseIf ll_status_code = -2 Then
ls_status_text = "There was an Error accessing Rest Service - Invalid URL"
ElseIf ll_status_code = -4 Then
ls_status_text = "There was an Error accessing Rest Service - Cannot connect to the Internet"
ElseIf ll_status_code = -5 Then
ls_status_text = "There was an Error accessing Rest Service - Unsupported secure (HTTPS) connection attempted"
ElseIf ll_status_code = -6 Then
ls_status_text = "There was an Error accessing Rest Service - Internet request failed"
End IF
// response from the service
ls_status_text = ls_status_text
ll_status_code = ll_status_code
ls_response_text = String(data.iblog_data,EncodingAnsi!)
When everything is working as expected, I get a XML in ls_response_text and I parse it using PBDOM.
When the web service is "down" there is a html page returned in ls_response_text field.
But ll_status_code returns as 1 which is a "success".
ls_response_text HTML looks like below:
Service Unavailable
HTTP Error 503. The service is unavailable.
I need to capture the HTTP Error 503 in this html. Has anyone done this in their projects?
Same question in this discussion board - http://pbgeeks.com/forums/topic/how-to-get-http-error-codes-from-internet-object-in-powerbuilder/