Question

I need to develop a minimalistic webservice. It should have 2 functions:

  1. senduserdata (a remote app will call "senduserdata" to send info about users, like "ID" and "amount")
  2. sendconfirmation (a remote app will tell "all ok for proccess ID=X, notes are: NOTES)

In past I did a SOAP dll that needs IIS to run, since deployment is crucial in my case and IIS is not always available is it possible to have a standalone exe that exposes the SOAP (or REST) interface?

Was it helpful?

Solution

I succeded in a few minutes using the RemObjects trial and setting SOAP as communication protocol in a server + client project group (note: i need server only).

With a VCL EXE i can deploy much easier (i have lots of customers, and accessing their IIS to install a dll it is sometimes too hard).

OTHER TIPS

Yes, you can use any TCP library for Delphi which includes a HTTP server, for example Internet Direct (Indy). With Indy, you can create a stand-alone application (or better, a windows service) without IIS.

In a RESTful web application, the senduserdata command would be implemented by a URL like

    http://example.com/api/users

The clients then use a HTTP PUT or PATCH request to update the users resource.

A senduserdate call for user id 774422 would be written like

    LStream := TStringStream.Create('{ "amount":100.50, "currency":"EUR" }');
    try
      HTTP := TIdHTTP.Create;
      try
        HTTP.Put('http://example.com/api/users/774422', LStream);
      finally
        HTTP.Free;
      end;
    finally
      LStream.Free;
    end;

In the the Delphi application for server side, a TIdHTTPServer component then listens for HTTP requests for the /rest/users resource and in the OnCommandOther event handler it would extract the request body string, parse it, and apply the changes to the user with the ID given in the resource path (/774422).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top