Subject Re: Creating Webserver to process Http APIs - 1 attachment
From Boris Borzic <.> <Boris Borzic <.>>
Date Thu, 1 Jul 2021 11:19:59 -0400
Newsgroups xb2net
Attachment(s) json_ws_test.prg

Osvaldo Aoki <> wrote in

>    I am a Software ERP developer wrotten in Alaska Xbase.
>    I am analyzing Xb2Net to create a program to receive API Call (Web
>    Services - JSON), and process them, return result to the caller.
>    For each received Call, I think to create a Thread to attend and
>    process API separated. In My system, I just have a Program that
>    keep in Looping to processo all request IN and attend API Web
>    service. I just want to know if any people already do it, and if
>    this idea is possible to implement. Thanks

This is extremely easy to do with Xb2.NET - use the sample WEBSERVE.PRG as
your starting point.

Attached is a very simple JSON server-side PRG script. Copy the attached
file into your .\www_root folder and call the function from your JSON
client. If the client is running on the same computer as the server the URL
will be this:


Note that you can execute this from a browser. The PRG will be compiled,
but you will get the following message: "Method Not Allowed". The reason is
the web service function is expecting a POST with content-type:

When the request comes in as a POST with content-type "application/json",
the server returns the following JSON message:


Best regards,
Boris Borzic
industrial strength Xbase++ development tools

Recent messages in this thread
-# Creating Webserver to process Http APIs Osvaldo Aoki 30-Jun-2021 02:43 pm
.\# Re: Creating Webserver to process Http APIs - 1 attachment (Current message) Boris Borzic <.> 01-Jul-2021 11:19 am