views:

200

answers:

7

After reading this article about SOAP versus REST I started to wonder what option Delphi developers have on choosing a good REST library to import REST-service functionality inside Delphi/WIN32 applications. And what options there are to create REST services in Delphi. So I have a few related questions:

  1. Is there any open-source REST library for creating Delphi clients?
  2. Is there any open-source REST library for creating Delphi Services?
  3. If no on both, what commercial options are there?

Since SOAP is apparently declining in usage, I can imagine the need for Delphi developers to switch to REST-based services. Especially those Delphi developers who still write native WIN32 applications.

Marco Cantu has set up several sample REST clients at his site which are practical. But it's not enough for me. :-)

+2  A: 

The REST Wikipedia article lists Ext JS as one of the available REST framework implementations. There is an open source server side framework for Delphi based on Ext JS, called ExtPascal. However I do not know how far this Delphi framework integrates with the REST part of Ext JS.

mjustin
+2  A: 

That's kinda the beauty of REST though isn't it, that you don't need to go through that SOAP rigmarole of importing the spec from some website and having it not work a million times and not being able to debug it.

I'd say, just use Indy and parse the post data yourself.

If you ever make anything with REST and Delphi, please comment on this though, I'd love to see how you do it.

Also, you might want to check out Marco's 2010 handbook the last chapter probably covers REST in more depth than he does with the code examples on his site.

Peter Turner
Yes, I know you can use REST without a proper framework. That's my current solution! :-) But it's not a RAD solution, and it makes the code a bit difficult for other, inexperienced developers in my team.
Workshop Alex
+3  A: 

Delphi, to my knowledge, was one of the first applications to use REST as its primary means of providing web functionality (back in 1997 I believe). The web broker component, although its been around for a while, is designed to support Rest-ful services and works very well. Add security and templates and compile into an ISAPI plugin module, and you have everything you need to support REST. The only issue I see with the web broker is the issue with Delphi as a whole - lack of 64 bit support. However, it runs just fine under 64 bit - just doesn't leverage it.

Our company has over 250 clients whose websites are running based upon Rest-based web services built with Delphi. It's an elegant solution - if a developer wants an XML packet as result, he just adds RT=XML, if she wants JSON, its RT=JSON, a nice HTML chunck to put into a CMS, RT=HTML (or leave it alone as it is the default). Changing the whole look and feel of the result sets requires changing a single CSS file.

Charlie V
To answer the JSON question below - we use extJS pretty extensively for developing internal user applications - what's neat is that they call the exact same REST web services as the public website, but just use different result sets (and added security). You do an ajax call to get the JSON result set from the web service (e.g.,CustomerOrderHistory?RT=JSON) and then bind the JSON result to a grid.
Charlie V
Back in 1997? So Delphi has shipped REST already three years before it was introduced and defined by Roy Fielding (in 2000) :)
mjustin
@mjustin REST was based on studying the architectural principles underlying the world wide web. Principles that were already in use well before Roy Fielding wrote his dissertation. He just identified them and gave them a name.
codeelegance
I am very familiar with Roy Fieldings work - and yes, what he coined as REST already existed before he published it. Delphi 3, which was introduced in 1997, included the web broker and was accessed through GET, POST, PUT and DELETE - the foundation of REST.
Charlie V
+3  A: 

We've developped an Open Source Client AND Server RESTfull framework, using JSON for the data exchange.

You've got a whole ORM framework, with remote or local direct access, accessible through HTTP/1.1, named pipes or Windows GDI messages.

The remote database is accessed via an automated RESTful mechanism, and you can easily implement additional Server-side REST-compatible services, if the direct database REST URI are not sufficient for your purpose.

It compiles from Delphi 6 up to Delphi XE. It's fully Unicode compliant on all these platforms (it uses UTF-8 encoding internaly).

The Synopse SQLite3 database Framework was designed in accordance with Fielding's REST architectural style without using HTTP and without interacting with the World Wide Web. Such Systems which follow REST principles are often referred to as "RESTful". Optionaly, the Framework is able to serve standard HTTP/1.1 pages over the Internet (by using the SQLite3Http unit and the TSQLite3HttpServer and TSQLite3HttpClient classes), in an embedded low resource and fast HTTP server.

The standard RESTful methods are implemented: - GET to list the members of the collection; - PUT to update a member of the collection; - POST to create a new entry in the collection; - DELETE to delete a member of the collection.

The following methods were added to the standard REST definition, for locking individual records and for handling database transactions (which speed up database process): - LOCK to lock a member of the collection; - UNLOCK to unlock a member of the collection; - BEGIN to initiate a transaction; - END to commit a transaction; - ABORT to rollback a transaction.

About our REST implementation, see http://synopse.info/forum/viewtopic.php?pid=16#p16

A. Bouchez
So much for that stateless constraint eh!
Darrel Miller
I was not a strong believer of stateless architecture at first, but with our framework, I found out that it could be a great idea in most projects. When you've coded the client and server part, it's very easy to use in your applications. Even the UI refreshing can be done asynchronously, with corresponding requests from the VCL side. Nice solution in practice.
A. Bouchez
+3  A: 

I suggest this open source project "Delphi on Rails": http://www.delphionrails.com

DOR is a web server based on REST, MVC, JSON, XML. It make intensive usage of new RTTI in Delphi 2010 and XE.

It use only open source projects usable in a commercial application:

  • Database: Firebird
  • Script: LUA
  • Graphic: CAIRO (png, svg, pdf ...)
Henri Gourvest
A: 

I am also looking at JSON/Rest to do my new desktop application. I want to write Server and Client using Rest and use it with InstantObjects. Could anyone tell me if it would be possible to achieve this?

+1  A: 

Datasnap technology that shipped with Delphi support creating REST service since Delphi 2010 or maybe Delphi 2009.

Mohammed Nasman