153

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.

Warren P
  • 65,725
  • 40
  • 181
  • 316
  • 3
    [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. –  Jun 20 '11 at 21:02
  • 13
    @Dorin - Using The WSDL importer is very easy to create a SOAP client. – Robert Love Jun 20 '11 at 21:09
  • 8
    @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. –  Jun 21 '11 at 06:34
  • 2
    Well, I'm working on building a simple one that is entirely based on "custom methods", and does not involve any dataset-remoting-over-soap, which is the source of most of the complexity in the RAD Demo mentioned in my question. – Warren P Jun 21 '11 at 15:17
  • 1
    There is a Client and Server [Web Service Toolkit](http://wiki.freepascal.org/Web_Service_Toolkit) which supports Delphi and Free Pascal, WSDL and SOAP 1.1. – mjn Sep 03 '11 at 10:35
  • 5
    easiest soap is .net wcf – hidden Sep 14 '11 at 01:31
  • 5
    There is a tutorial video at http://edn.embarcadero.com/article/40973 . relevant? – Alex Sep 20 '11 at 19:02
  • 2
    Theres 2 videos in [delphi.Wikia](http://delphi.wikia.com/wiki/Delphi_Videos), including [this one](http://www.onlinedelphitraining.com/webservices.html) "That's scary, google." Mades me LOL really hard. Try Yahoo!... Really. – EMBarbosa Sep 27 '11 at 03:44
  • 1
    We struggled trying to get Indy/WAD to work, gave up, and just run under Apache locally. The same app runs fine under IIS. Our servers run IIS, but our desktops run XP, so they won't run the same version of IIS, so we just run Apache/XAMPP locally. Works great, but we're left with primitive debugging (writeln, GExperts, etc..). It works ok for us, as we put most of the business logic in a DLL that we can test independently of the service. – Chris Thornton Nov 15 '11 at 15:56
  • 1
    Soap clients in Delphi are a pain if you have to import a non-delphi wsdl. .NET's WCF does things that Delphi, Java, or Remo Obj can't seem to figure out... at least not in an automated way. But if you are making both the server and the client, it should work just fine. – GDF Mar 09 '12 at 22:18
  • @GDF: I'm trying to build libraries of samples, I'd like to do a Delphi to WCF demo to add to this list, as that's going to be important for everybody. Email me if you're interested in helping with testing or implementing such a demo. I'd like to know what attributes in a non-delphi WSDL cause problems so we could try to deal with it in a demo. – Warren P Mar 28 '12 at 14:12
  • Never got the hang of any of WAD stuff, and it was a pain to have to change things around when you wanted to deploy. So I just develop webServices in XE, deploy locally on IIS and import the WSDL to get a proxy class for client. When debugging I launch the IIS process through a browser or simple 'do nothing' call from client, and use run/attach to process for debugging. Works great. Never had any problems this way - except for configuring IIS 7.5, but that had nothing to do with Delphi webServices. – Vector May 01 '12 at 17:00

1 Answers1

42

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

Warren P
  • 65,725
  • 40
  • 181
  • 316
  • 1
    Bravo for the effort! If you can't post the fixed demo, maybe a diff/patch would do? – Chris Thornton Mar 27 '12 at 13:57
  • 8
    It's an old principle of the open-source community; Scratch your own itch, and the share the results, and hopefully it will not only benefit everyone, but build a community, over time, that can do things together that we couldn't do alone. So PLEASE send me bug reports if you find problems. – Warren P Mar 29 '12 at 13:19