1. Dong Le
  2. PowerBuilder
  3. Thursday, 27 September 2018 09:53 AM UTC

Hi All,

 

As before we use some component on EA server, then client could using contextkeyword getcontextservice to call the from server. But as EA server is demised on the new version. Do you have any suggestions about how to handle those component by the new version 2017? 

Kevin Ridley Accepted Answer Pending Moderation
  1. Thursday, 27 September 2018 12:18 PM UTC
  2. PowerBuilder
  3. # 1

Yes absolutely!  You need to migrate your server components to either Java or .NET and pass JSON back and forth.  Take a look at the new ImportJSON and ExportJSON methods of the datawindow/datastore.  If you use Java, it will be a little harder since you won't be able to take advantage of the datawindow on the server side, but you can still pass JSON. 

 

.NET (easiest way)

  • Use datastore to retrieve, return JSON string from ExportJSON method (note: there are different arguments to this function.  For a simple retrieve, you'd probably just want the basic JSON string returned)
  • On the client side, you would either call the .NET component through a web service or .NET assembly.  You would get the JSON string returned and use ImportJSON to display the data in your app.
  • Changes on the client side are captured using the ExportJSON (note: this time you would capture the full state similar to GetFullState method.  Advanced users (better performance) might consider doing a GetChanges on the dw and then SetFullState to a datastore, followed by a ExportJSON to get a smaller JSON string with only the changes instead of all rows in the dw.
  • Client side update JSON is passed to the server again either via a web service or .NET assembly.  Server component takes the passed JSON string and uses datastore.ImportJSON to set the changes and then just Update the datastore.

Pretty easy and almost the exact same pattern as current EA Server.

 

Java - more complicated, but do-able

  • Retrieve to a SQL resultset, then convert to JSON string using JSONObject and JSONArray
  • Client would use a REST web service to call the retrieve and get JSON back.  Use same ImportJSON to display the data.
  • Slightly more challenging on the update: inserts, deletes and updates would have to be handled separately.  Some of this can be handled with design by not allowing all 3 on the same dw, but if not you can process each separately by checking the dw rowstatus.
  • Either way, use ExportJSON for the updates and inserts.  I'd probably have a method on the server for deletes that just took the key value(s).
  • Client calls separate methods for Insert, Update, Delete via web service passing JSON for insert and update or key(s) for Delete

That's about it.  I'm planning to do a webcast on this coming in the next month or 2, probably after Elevate.  Feel free to reach out if you need any professional assistance with this.

 

Kevin

kjr_23@yahoo.com

 

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 27 September 2018 13:34 PM UTC
  2. PowerBuilder
  3. # 2

If you are feeling really adventurous, I created an ISAPI Extension which allows PowerBuilder objects to run within IIS directly from the PBL. The ancestor objects provide the functions you would have using Classic ASP to write web pages. The demo shows visual web pages and in PB 2017 you can use Native PDF to return a PDF to the web browser.

You could run these components from a PB desktop app using the GetURL function or the new HTTP client functionality.

 

Look for PBDotWeb on this page:

http://www.topwizprogramming.com/tools.html

 

I have no idea if anyone is actually using this in production or how well it works in a high volume scenario.

 

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 27 September 2018 14:16 PM UTC
  2. PowerBuilder
  3. # 3

Hi Roland;

  That is a very "kool" PBNI adaptation!

I have it working with my frameworks.

Regards ... Chris

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.