1. Miller Rhodes
  2. PowerBuilder
  3. Thursday, 2 June 2022 19:13 PM UTC

Currently, we are using the OauthClient object to request a token and then use that token to get the data using the RequestResource function.

Thanks to a lot of the posts I have seen here, I was able to put this together and it works quite well.

Until...  It gets into Citrix.

In the code example below , this line works fine :  ll_Return = loac_Client.AccessToken( ltr_Request, ltr_Response )

but this line returns a -1  : ll_return = loac_Client.RequestResource( loar_Request, lrr_Response )

 

I am wondering if anyone else has had difficulties when they get into Citrix and is there a way to overcome it?

 

//The complete code example is as below:

OAuthClient loac_Client
TokenRequest ltr_Request
TokenResponse ltr_Response
OAuthRequest loar_Request
ResourceResponse lrr_Response
String ls_AccessToken, ls_parameter_string
String ls_Body, ls_type, ls_description, ls_uri, ls_state, ls_token_body
Long ll_return, ll_return2, ll_ret, ll_ret2
Integer li_rtn
Blob lblb_data
String ls_encode_scope

 

loac_Client = Create OAuthClient
date ld_startdate, ld_end_date

CoderObject lnv_CoderObject
lnv_CoderObject = Create CoderObject
lblb_data = Blob(is_scope, EncodingANSI!)
ls_encode_scope = lnv_CoderObject.UrlEncode(lblb_data)

ls_parameter_string = '?equipmentInitial=' + is_equipment_initial
ls_parameter_string += '&equipmentNumber=' + string(il_equipment_number)
ls_parameter_string += '&startDate=' + string(idt_start_datetime, 'yyyy-mm-dd')
ls_parameter_string += '&endDate=' + string(idt_end_datetime, 'yyyy-mm-dd' )


ltr_Request.SetHeader('Content-Type', 'application/x-www-form-urlencoded')
ltr_Request.Method = "POST"
ltr_Request.tokenlocation = is_tokenlocation
ltr_Request.secureprotocol = 0
ltr_Request.clientid = is_clientid
ltr_Request.clientsecret = is_clientsecret
ltr_Request.scope = ls_encode_scope
ltr_Request.granttype = "client_credentials"

ltr_Request.timeout = 120
loar_Request.timeout = 120

Setpointer(hourglass!)

ll_Return = loac_Client.AccessToken( ltr_Request, ltr_Response )


If ll_Return = 1 and ltr_Response.GetStatusCode () = 200 Then
ll_Return = ltr_Response.GetBody(ls_token_body)
If ll_Return = 1 Then
ls_AccessToken = ltr_Response.GetAccessToken()
messagebox( ls_AccessToken, 'token')


//Step 2: Get the RESTful server resource.
loar_Request.Method = "GET"
loar_Request.Url = "https://elevate-k8s-dev.gmas.io/zones/movement-data-api/api/v1/MovementData"
loar_Request.Url += ls_parameter_string
ll_ret = loar_Request.SetAccessToken( ls_AccessToken )
messagebox(string(ll_ret), 'll_ret')
ll_return = loac_Client.RequestResource( loar_Request, lrr_Response )
If ll_Return <> 1 or lrr_Response.GetStatusCode () <> 200 Then
string(lrr_Response.GetStatusCode () ) )
ll_return = loac_Client.RequestResource( loar_Request, lrr_Response )
End If
If ll_Return = 1 and lrr_Response.GetStatusCode () = 200 Then
ll_return2 = lrr_Response.GetBody(ls_Body)
If ll_return2 < 1 then
MessageBox( "Failed to extract data from the API", "Return :" + String ( ll_return ) + "~r~n" + lrr_Response.GetStatusText() )
return -1
End If

string ls_JsonPackage, ls_Error
long ll_RowCount

JsonParser lnv_JsonParser
lnv_JsonParser = Create JsonParser
ls_Error = lnv_JsonParser.LoadString(ls_Body)
if Len(ls_Error) > 0 then
MessageBox("Error", ls_Error)
return -1
end if
ll_RowCount = dw_cp_movement.ImportJson(ls_Body)
dw_cp_movement.sort()

Else
MessageBox( "Request resource Failed", "Return :" + String ( ll_return ) + "~r~n" + lrr_Response.GetStatusText() )
return -1
End If

End If
Else
ll_Return = ltr_Response.GetTokenError(ls_type, ls_description, ls_uri, ls_state)
MessageBox( "AccessToken Falied", "Return :" + String ( ll_return ) + "~r~n" + ls_description )
return -1
End If


return 1

Accepted Answer
Miller Rhodes Accepted Answer Pending Moderation
  1. Sunday, 16 October 2022 16:05 PM UTC
  2. PowerBuilder
  3. # Permalink

Here is what we had to do to resolve this problem:

 

1. In our current deployment of Citrix, we cannot upgrade because the organization is on a path to an alternative.

2. Within this deployment we are limited to TLS 1.2 based on Citrix being on an older server and an upgrade being out of the question.

3. The API being called was being deployed through Kubernetes which is using TLS 1.3. This was no problem for Powerbuilder 2019 R3 deployed via the network.

4. This was a problem for Citrix however.  In order to solve this, we had to settle for an "On-Prem" deployment of the API which wasn't 'leading edge" or the "latest and greatest" but it was TLS 1.2 and that fixed the problem

Comment
  1. Miguel Leeuwe
  2. Monday, 17 October 2022 03:06 AM UTC
Thanks for sharing your solution!
  1. Helpful 1
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 3 June 2022 23:06 PM UTC
  2. PowerBuilder
  3. # 1

Hi,

I think you might get better support for this on the standard support site: https://www.appeon.com/standardsupport/newbug

There's some experience with Citrix.

regards.

Comment
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.