PowerBuilder’s SOAP to RESTful Evolution

The movement from SOAP-based web services towards RESTful-based web services is another evolutionary journey for PowerBuilder developers and their related applications. Originally, Sybase added SOAP (Simple Object Access Protocol)-based features in PowerBuilder version 8.0. The original SOAP features were aligned with the Java implementation of EasySOAP and provided a messaging protocol specification for exchanging structured information in the implementation of web services across computer networks. Sybase enhanced the web service feature in PowerBuilder version 9.0 to include the ability to handle more complex SOAP interactions. In PowerBuilder version 11.0, Sybase then added support for Microsoft’s .NET-based web service framework as well. This greatly improved the web service interaction possibilities in that era of PowerBuilder. The .NET web service feature was tweaked again in PowerBuilder version 11.5 (and latter PowerBuilder versions) to support the newer releases of the .NET framework.

Since PowerBuilder 11.5 though, the basic SOAP-based architecture has been PowerBuilder’s “go to” vehicle for web service interactions. However, the IT industry moved onward with newer REST (Representational State Transfer) web service technology, which has now become a de facto architectural style used by most modern web services. The REST approach defines a set of constraints and properties based on the HTTP protocol that provides greater interoperability between computer systems on the Internet today. By REST using a stateless protocol and standard operations, REST systems can have faster performance, reliability, and the ability to grow, by re-using components that can be managed and updated without affecting the system, even while it is running.

There are six guiding constraints that define a RESTful system. These constraints restrict the ways that the server may process and respond to client requests so that, by operating within these constraints, the service gains performance, scalability, simplicity, modifiability, visibility, portability, and reliability. If a service violates any of the required constraints, it cannot be considered RESTful. The formal REST constraints are as follows:

Client–server architectureStatelessnessCache-abilityLayered systemCode on demandUniform interface

The focus of a RESTful service is on resources and how to provide access to these resources. A resource can easily be thought of as an object as in OOP (object-oriented programming). A resource can consist of other embedded resources as well. While designing a system, the first thing to do is identify the resources and determine how they are related to each other. This is like the first steps of designing a database: identify entities and relations. Once we have identified our resources, the next thing we need is to find a way to represent these resources in our system. You can use any format for representing the resources, as REST does not put a restriction on the format of a representation.

The client and service talk to each other via messages. Clients send a request to the server, and the server replies with a response. Apart from the actual data, these messages also contain some metadata about the message. It is important to have some background about the HTTP request and response formats for designing RESTful Web services. REST requires each resource to have at least one URI (Uniform Resource Identifier). A RESTful service uses a directory hierarchy like human readable URIs to address its resources. The job of a URI is to identify a resource or a collection of resources. The actual operation is determined by an HTTP verb. The URI should not say anything about the operation or action. This enables us to call the same URI with different HTTP verbs to perform different operations.

Base64 – Your New Binary Friend

Wednesday , 24 January 2018
Featured
Base64 – Your New Binary Friend

PowerBuilder’s Web Service prowess has increased significantly in recent releases from Appeon - in particular, PB2017 R2 and R3 release. These PowerBuilder releases have given us a new HTTP Client and RESTful Client capabilities that can utilize the newer JSON (JavaScript Object Notation) data format and the ever-popular XML (Extensible Markup Language) data format as well. When processing standard data type information in either the JSON or XML format, the ease of data exchange is very high. However, when trying to transfer binary data, the JSON and XML formats and the supporting HTTP transport layer for RESTful web services will not readily handle binary data.

To address this binary dilemma in the JSON and XML realm, today’s applications utilize the Base64 binary-to-text encoding mechanism to convert binary data into ASCII text sequences of the data. This allows the converted data to be injected into the JSON or XML schema and transmitted without upsetting the HTTP transport protocol. While it does increase the overall transmission data length when utilizing this encoding scheme, it is necessary in order to achieve the end goal of data exchange with these technologies.

In PB2017 R3, PowerBuilder will be updated to include new functions to both encode and decode binary data to and from the Base64 encoding scheme. The new PB built-in Base64Encode and Base64Decode commands can now perform the encoding in and out of the Base64 scheme using the standard PowerBuilder run-time engine support. For example, the PB Base64 PNG image used in this article would look like the following in a hexadecimal editor:

Figure 1- PowerBuilder Base64 Image in Hex

Using the new built-in Base64Encode method, the PNG image binary data is converted into a set of ASCII character sequences which can now be easily transmitted or even read by a simple text editor, as follows:

PowerBuilder’s PDF Evolution

Wednesday , 10 January 2018
Featured
PowerBuilder’s PDF Evolution

 

 

 PowerBuilder’s prowess to be able to create Portable Document Format (PDF), has been supported for a long time in the product’s history.  PDF documents have become the gold standard for delivering information, especially in the form of reports. PowerBuilder’s PDF generation capabilities are as follows (in historical order of their introduction):

External DLL – third party solutions that can be called via PB external method declarations in the early days of PB.XLSFO (Extensible Stylesheet Language Formatting Objects) - a Java-based solution included with the PB run-time and supported by the DataWindow, which was introduced in PB 7.PostScript Printer – third party printer solutions that do not require a PB interface but only require a PB app to print to an MS-Windows installed printer.GhostScript – an open source solution that PB can utilize via a specially installed printer definition named “Sybase DataWindow PS”, which was introduced in PB 9.NativePDF – a built-in PDF solution (i.e. doesn’t require separate licensing or installation of third-party solutions), which was introduced in PB 2017.

All the above PDF generation mechanisms are still in place today (for backwards compatibility) in PB 2017. However, it is important to understand the advantages and disadvantages of these PDF generation mechanisms and use the appropriate one for your project, especially considering the enhancements made to the NativePDF option in the upcoming PB 2017 R3 release. In this blog, we’ll attempt to get a better perspective on these PDF options.

A variety of external PDF solutions exists for PowerBuilder and are commonly used in many existing projects. However, they often come with a significant extra price tag. They also come with the requirement to define external functions and maintain PowerScript code to support the external connectivity. Since these are developed and maintained by third party vendors, if you chose an unreliable vendor or the vendor ceases to continue the product then to move to a new vendor’s product usually will require a significant re-programming effort.  On the plus side, if you choose a good third-party product, it produces a high-quality rendering and supports advanced PDF features.