1. Praveen Rajarao
  2. PowerBuilder
  3. Tuesday, 1 May 2018 20:07 PM UTC

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

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/

 

 

 

Olan Knight Accepted Answer Pending Moderation
  1. Thursday, 3 May 2018 19:13 PM UTC
  2. PowerBuilder
  3. # 1

It appears as if the "1" is being returned for every result.
The easiest way to find the correct result would be to determine the actual error codes returned in the CML and scan for them.

In this case you would scan for " Error 503" or for  "The service is unavailable."

 

Olan

Comment
There are no comments made yet.
Marco Meoni Accepted Answer Pending Moderation
  1. Wednesday, 2 May 2018 06:18 AM UTC
  2. PowerBuilder
  3. # 2

Hi Praveen,

there is no native n_cst_internet object in Powerbuilder, I assume you have inherited it from iNet or InternetResult in order to get/post URLs.

I suggest you use the new PB 2017 HTTPClient object, which has superseded iNet and offers a larger and easier support to Get/Post/Put/Delete methods (and SSL too).

Best,

Marco

Comment
  1. Praveen Rajarao
  2. Wednesday, 2 May 2018 13:06 PM UTC
Yes I have inherited, sorry about that. 



My client has no plans to upgrade to PB2017 as of now, we are on PB12.5.2. I need to make this work somehow. 

  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.