152
votes

Delphi used to include a demos folder for web Services, but no longer seems to include this.

I just tried the Delphi 7 demo projects (SOAPDMServerWAD, a server with almost no UI at all, and SOAPDMClient) and was unable to get them to function, even in Delphi 7.

If anybody has ever made a similar demo work in Delphi XE, or Delphi 2010, identical to the old SOAPDMServerWAD+SoapDMClient demos, working in Delphi XE, and with at least the minimal UI that comes from the Delphi SOAP Server application wizard, that would be perfect.

Update: The demo appears all the way up to Delphi 2010 but uses the now-obsoleted WAD (web-app-debugger), I tried to port it to the new Indy runtime/web-app-development-harnessing-code, but I can't seem to get it working. The demo runs, but the server has no User interface, and does not appear to be running any HTTP server (tested using a regular web browser, via http://localhost:port/ urls. By the way, try googling for a demo, and this url comes up, and I asked less than an hour ago. That's scary, google.

Update2 See my own answer below, a link is coming soon with working code.

1
[offtopic] I've had to create a pretty simple SOAP client in Delphi a couple of months ago, proved to be quite a headache and waste of productivity, I suggest looking for an alternative meanwhile.user497849
@Dorin - Using The WSDL importer is very easy to create a SOAP client.Robert Love
@Robert it's not that part which is giving headaches, it's the documentation and lack of demos, etc. I had to learn way too much about SOAP for a simplistic client, which did not serve me too much, from what I've understood in Java is way easier but haven't tried it => I'm a delphi die-hard user.user497849
easiest soap is .net wcfhidden
There is a tutorial video at edn.embarcadero.com/article/40973 . relevant?Alex

1 Answers

40
votes

I have posted the complete set of demos for SOAP on CodeCentral as item 28789.

These contain every single one of the Delphi 2007 era SOAP demos from the WebServices folder, now updated for Delphi XE and XE2, including converting the old WAD servers into new INDY VCL servers. You'd think that was impressive, except it's not. It's really easy. Just use the wizard to create a new project, and then add the web service interface and implementation units, and any other units that belong in the old demo, to the project. Once they're added to the project, they just work. Basic demo SOAP Servers are really easy to build in Delphi, once you have a working demo, you'll find it's pretty easy to modify and extend it.

The demo that best answers the question I asked above is in the SOAPDataModule sub-folder.

The basic problems with the demo from the 2007 era are two:

  1. The WAD (web app debugger) is gone. you have to make a new server using the Indy server, for optimal demo purposes, saving you from using WAD (which is gone) or setting up ISAPI environment, under IIS, which is hardly ideal for demo purposes. The new demo project I made is called SoapDMServerINDY, and it consists of a data module (datamod_u.pas), a VCL form User Interface unit (IndyServerVCLFormUnit.pas) and an Indy Server web module, called IndyServerWebModule.pas.

  2. The Delphi 2007 demo broke thanks to the new practice of having a Debug/Win32 subfolder that the demo executable is now in, you need to go up further. I fixed the demo server so that it warns you with an error message if the data files cannot be located, saving you from the mysterious "XML parsing error". I also added some error checking in a few of the demos so that it tells you that you need to install interbase for this demo to work, since some of the demos require Interbase installed and running, and one requires an alias called IBLOCAL to exist, and preferably a table called EMPLOYEE to exist.

enter image description here

The elements of this demo are a server (SoapDMServerINDY, based on the code from SOAPDMServerWAD), and the client SOAPDMClient which connects to the demo and has two pages, one page will show basic data access via a DBGrid + dataset remoting, and the second page shows how to invoke a custom SOAP method.

To use the demo: You have to start the server, click the start button, then start the client and click Connect.

enter image description here