I have just started looking into Windows Communication Foundation.
Pawel Glowacki created a really nice article on the CodeGear Developer Network titled Introduction to WCF Programming in Delphi.
I'm particularly interested in web development and I noticed that there is a WCF Service Template in Visual Studio 2005, so I have converted it to Delphi.
I have uploaded the template to CodeCentral.
If you are not sure how to use the template, I have a blog post about templates and how you install them,
Once installed you can now create a new WCF Service application
You should end up with a new ASP.Net Web Application with a single WCF Service.
Assuming that you have already installed Microsoft dotnet v3.0, you can now build and run the application.
The service description should now appear in a browser.
To exercise the web application you need to do the following:-
1) Create a new VCL.Net application
2) Add a reference to the System.ServiceModel assembly
C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0
to the compiler search path
4) Your code might look something like
System.ServiceModel, Service, System.ServiceModel.Channels;
procedure TForm1.Button1Click(Sender: TObject);
aEndpointAddress := EndpointAddress.Create('http://localhost:8080/WCFServiceWebApplication1/Service.svc');
aBinding := WSHttpBinding.Create;
aFactory := ChannelFactory<IMyService>.Create(aBinding, aEndpointAddress);
aChannel := aFactory.CreateChannel;
on E:Exception do
A word of warning, if like me you use Cassini as your web server, I think you need to upgrade to the latest version. Below is a screenshot of the application running with the version of Cassini supplied with Delphi 2007.
Please read my blog post about upgrading Cassini.
I also see that Pawel is doing a presentation at CodeRage II titled "Delphi for .NET WCF Programming: Deeper Dive", I'm looking forward to listening to that,