View Full Version : Delphi and .net WCF service problem

22-06-2009, 02:56 PM

Anyone have experience writing a Delphi app that connects to a .net WCF service ? Im an having no fun with this at all. Ive imported the WSDL file but when I call a function on the service I get the following message: error in deserializing body of reply message for operation xyz... Ive configured my WCF service to communicate using SOAP 1.1 as Delphi 7 only supports this version. Does anyone know of an application that I can use to see what the XML looks like that is coming back from the service ?


22-06-2009, 03:44 PM
The only thing I can think of doing would be to write a simply 'proxy' using say Indy (it's http based protocol no?).

Use a TIDHTTPServer (I think) to capture the request, drop it into a memo so you can see it and then forward it to the real server with TIDHTTP (I think) and then grab the response and dump that into a memo.

Thats what I'd do, or have a nose around the web for debugging proxies... I've encountered some in the past when I've been looking to debug http requests, but off the top I can't think of any specific places to look other than google.

Hope this helps.

22-06-2009, 06:07 PM
use your webbrowser to visit the webservice url there you should be able to see a list of its functions together with a testing form. What kind of (data)types are you using? Only the basic ones work out of the box so you might also want to take a look at the generated source you use to connect to the webservice. Hope this is of some help.

E.g. have a look at the babelcode webservice: http://lingua.embarcadero.com/babelcode/converter.asmx

22-06-2009, 07:12 PM
I managed to capture the output from my Delphi client and the way it's formed isn't correct or at least it's not the same as the output from the .net WCF Test Client. I'm not sure if this is a soap 1.1 / soap 1.2 issue. I'm using the basic http binding in the service which "should" be soap 1.1 complient. I can use IE to view the service and wsdl details and the service works fine from a .net client but Delphi is not playing ball :( Time for a bit more googling of binging.

23-06-2009, 09:25 AM
Just in case anyone else is going through the pain of Delphi to .net WCF service then you may be interested in how I fixed my problem. The unit that is created when you import the WSDL has some lines of code in the initialization section. One of them may look like this InvRegistry.RegisterInvokeOptions(TypeInfo(IUse rImageService), ioDocument);. The cause of my problem was that ioDocument was actually set to ioLiteral. When it was set to ioLiteral the SOAP envelope XML wasnt formed in a way that the WCF service was expecting. Once I changed it to ioDocument the XML was created differently and matched the XML created by the Visual Studio WCF Test Client. It now works but this was a very unpleasant experience due to the lack of help and documentation.

Thanks for all your help