PowerServer Web APIs Concepts

PowerServer Web APIs serve as the core of the backend architecture in PowerServer's n-tier environment. All data operations are handled through PowerServer Web APIs. It is very important to understand how PowerServer Web APIs function.

  • During the compilation process, PowerBuilder IDE converts all DataWindows, DataStores, and DDDWs in your application into PowerServer C# models. The structure and rules of the DataWindow such as columns, data types, validations, and expressions are replicated in the corresponding C# class. It is very important that the C# models are generated successfully and correctly.

    Reference: PowerServer C# models

  • PowerServer generates RESTful Web APIs based on the C# models that correspond to your DataWindows and embedded SQLs. These Web APIs make CRUD (Create, Read, Update, Delete) operations accessible to your PowerBuilder application via HTTP requests. Besides that, PowerServer can also manage authentication, API access control, logging etc.

    Reference: PowerServer Web APIs, PowerServer C# solution

  • To function properly, PowerServer Web APIs must run on a web server (typically IIS or another ASP.NET-compatible server). Ensure that your server environment is configured properly to host PowerServer Web APIs.

    Below are some recommended hosting options for PowerServer Web APIs.

    For testing or development:

    1. Kestrel Web Server (Built-in)

      Kestrel is the built-in web server for ASP.NET Core. It is lightweight, requires no setup, and runs directly on your development machine, making it ideal for local testing. However, it is not recommended for production environments due to its limited security and performance features. (In production, Kestrel is usually run behind a web server like IIS, Nginx, Apache etc.)

    For production deployment:

    1. IIS (On-Premise or VM-Hosted)

      IIS is a familiar choice for PowerBuilder developers and provides full control over server settings. You can install it on a local server or a Windows-based virtual machine. It requires manual setup and maintenance. Deployment to IIS is directly supported by PowerServer tools.

    2. Azure VM + IIS

      Using IIS on an Azure Virtual Machine combines the flexibility and control of traditional IIS hosting with the benefits of the Azure platform like cloud scalability, backups, and automatic updates.

    3. Azure App Service (Windows)

      Azure App Service (Windows) is a fully managed platform for hosting web applications. You don't need to manage servers or IIS directly, as App Service handles infrastructure tasks such as scaling, patching, and load balancing automatically. It is a strong long-term option if you are looking to minimize infrastructure management.

    In addition to the options listed above, you can also host your PowerServer Web APIs using

    • Nginx

    • Docker containers

    • Kubernetes

    • Azue Container Instances

    • AWS Elastic Beanstalk

    • etc.

    Reference: Server Setup

  • The application no longer connects directly to the database. Instead, it sends HTTP requests to the Web APIs for all database operations. Therefore it is very important that the correct Web API URL is specified in the client app. This URL should point to the correct server and the root endpoint (base URL) of PowerServer Web APIs.

    Reference: Web API URL

  • PowerServer Web APIs are specifically tailored to a single PowerBuilder application and are not designed for use by other applications. If you require external access (e.g., for Java-based applications or non-PowerBuilder clients), additional services and APIs are required. This can be accomplished by creating a .NET DataStore project in PowerBuilder.

    Reference: .NET DataStore project