weburg.com weburg.com

Home > Generic HTTP Web Service (GHoWSt)

Introduction

Striving to be the C ABI of the Web platform.

GHoWSt is a multi-language, dynamic, native HTTP client and server RPC-style architecture free of schema, compilers, tooling, etc. Create a client in one line of code, call a remote method in the second line. Implement the service class, and its public interface is translated automatically to handle requests and display the service description for human or machine consumption. The Generic HTTP Web Service (GHoWSt) project maps native programming language semantics (methods/functions, arguments, return values, errors or exceptions) to and from basic HTTP requests in a generic, dynamic way based on convention. HTTP methods (GET, POST, PUT, PATCH, DELETE) are used to work with resources as usual, and subresources are used to implement custom methods that don't fit the standard HTTP methods.

The programmatic client uses any available dynamic proxy to translate class method calls to HTTP on the fly. In the case of C, the calling functions are written manually, but the library's invoker still does most of the lower level work. The Java client only needs an interface. The server maps the calls into the implementation automatically with an interface or equivalent. Visualizing it:

GHoWSt diagram

Motivation

GHoWSt is meant to require minimal effort for making Web service calls, leading to rapid prototyping. It is also designed for good production performance and works in browsers as well as servers. You can even use a plain HTML form with it, or more commonly, a rich client. The Java server translates the class interface to a human and machine-readable list of methods and parameters based on content negotiation at the root service URL to aid in service understanding. Where supported, annotations or the equivalent help document the service further. Additionally, OPTIONS requests are served automatically based on URI, to show a given resource's supported HTTP methods.

I made this for various reasons. Initially, it was to help me learn and practice a variety of languages and toolchains while making something potentially useful to a wider audience. But it turns out, members of my household and I have used it to do fun and silly networking stuff with whatever language, OS, and PC is available.

Technical details

Currently supported languages and their client and server GitHub repositories

Further information