Example (using OAuthClient) – PB Docs 2017
Example (using OAuthClient)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
OAuthClient loac_Client TokenRequest ltr_Request TokenResponse ltr_Response OAuthRequest loar_Request ResourceResponse lrr_Response CoderObject lco_Code String ls_AccessToken, ls_refresh_token, ls_ClientID, ls_Sercet, ls_Auth String ls_Body, ls_type, ls_description, ls_uri, ls_state Long ll_return Blob lblb_data loac_Client = Create OAuthClient lco_Code = Create CoderObject <span><strong>//Step 1: Get the RESTful server access token.</strong></span> //Authorization ls_ClientID = "367c4163ddc1427d96655cd220c6714b" ls_Sercet = "4079f8749939446cbc81fd0c27709187" lblb_data = Blob ( ls_ClientID + ":" + ls_Sercet, EncodingUTF8! ) ls_Auth = lco_Code.Base64Encode( lblb_data ) ltr_Request.SetHeader( "Authorization", "Basic " + ls_Auth ) ltr_Request.SetHeader( "Content-Type", "application/x-www-form-urlencoded" ) ltr_Request.tokenlocation = "https://authserver.appeon.com/oauth2/token" ltr_Request.Method = "POST" ltr_Request.secureprotocol = 0 ltr_Request.scope = "testcode upcode profile offline_access" ltr_Request.granttype = "refresh_token" ls_refresh_token = "8a9767b5f7e59245339cb965ce4bfdf589e155535c042a8b2a90d89093eefb7e" ltr_Request.AppendParam("refresh_token",ls_refresh_token ) 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_Body) If ll_Return = 1 Then ls_AccessToken = ltr_Response.GetAccessToken() <span><strong>//Step 2: Get the RESTful server resource. </strong></span> loar_Request.Method = "GET" loar_Request.Url = "https://authserver.appeon.com/order/getall" loar_Request.SetAccessToken( ls_AccessToken ) ll_Return = loac_Client.RequestResource( loar_Request, lrr_Response ) If ll_Return = 1 Then ll_Return = lrr_Response.GetBody(ls_Body) If ll_Return = 1 Then MessageBox ( "Resource", ls_Body ) End If Else MessageBox( "Requestresource Falied", "Return :" + String ( ll_return ) + "~r~n" + lrr_Response.GetStatusText() ) 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 ) End If If IsValid ( loac_Client ) Then DesTroy ( loac_Client ) If IsValid ( lco_Code ) Then DesTroy ( lco_Code ) |
Document get from Powerbuilder help Thank you for watching.
Using the Preview tab to connect in a PowerBuilder application – PB Docs 2017
Using the Preview tab to connect in a PowerBuilder application The Preview tab page in the Database Profile Setup dialog box makes it easy to generate accurate PowerScript connection syntax in the development environment for use in your PowerBuilder application script. As you complete the Database Profile Setup dialog box, the correct PowerScript connection syntax…
Using the JDBC Interface – PB Docs 2017
Using the JDBC Interface Contents About the JDBC interface Preparing to use the JDBC interface Defining the JDBC interface About this chapter This chapter describes the JDBC interface and explains how to prepare to use this interface and how to define the JDBC database profile. For more information For more detailed information about JDBC, go…
What to do next – PB Docs 2017
What to do next For instructions on preparing to use and then defining an ODBC data source, see Using the ODBC Interface. For instructions on preparing to use and then defining a JDBC database interface, see Using the JDBC Interface. For instructions on preparing to use and then defining an OLE DB data provider, see…
Troubleshooting Your Connection – PB Docs 2017
Troubleshooting Your Connection Contents Overview of troubleshooting tools Using the Database Trace tool Using the SQL statement trace utility Using the ODBC Driver Manager Trace tool Using the JDBC Driver Manager Trace tool About this chapter This chapter describes how to troubleshoot your database connection in PowerBuilder by using the following tools: Database Trace SQL Statement…
Properties – PB Docs 2017
Properties database parameter Description Sets properties specific to the particular JDBC driver you are using to connect to the database. Applies to JDB JDBC Syntax
|
1 |
Properties='property_value' |
Default value None Usage The Driver-Specific Properties box allows you to set properties specific to a particular driver. For information about the properties supported by your JDBC driver, see…
Using database profiles – PB Docs 2017
Using database profiles What is a database profile? A database profile is a named set of parameters stored in the registry that defines a connection to a particular database in the PowerBuilder development environment. Why use database profiles? Creating and using database profiles is the easiest way to manage your database connections in PowerBuilder because you can:…
Log – PB Docs 2017
Log database parameter Description Specifies whether the database server should log updates of text and image data in the transaction log. By default, the database server logs updates of text and image data in the transaction log. Applies to ASE and SYCÂ SAP Adaptive Server Enterprise Syntax
|
1 |
Log=value |
Parameter Description value A value that specifies whether…
Release – PB Docs 2017
Release database parameter Description Specifies what version of SAP Sybase Open Client Client-Library (CT-Lib) software is in use on the client workstation. When to specify Release You must specify a value for Release before connecting to the database. Applies to ASE, SYC SAP Adaptive Server Enterprise Syntax
|
1 |
Release='value' |
Parameter Description value Specifies the version of…
Time – PB Docs 2017
Time database parameter Description When you update data in the DataWindow painter, PowerBuilder builds a SQL UPDATE statement in the background. The Time parameter determines how PowerBuilder specifies a time datatype when it builds the SQL UPDATE statement. Applies to JDB JDBC ODBC O90 Oracle9i O10 Oracle 10g ORA Oracle 11g Syntax The syntax you use to specify the Time parameter differs…