Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF service exposed as ASMX won't accept parameters

I have a server/client application developed in Delphi 2006. The client is Win32 and the Server is a .net 1.1 webservice.

We are in the process of updateing this project, but it has to be done in small steps. I started with the server and created a WCF project in VS2010(C# .net 4.0). The first step is to get the server running in WCF without changing the client. So I used the facade pattern, created a similar interface to the old delphi Webservice added a reference to the old .net 1.1 dll and in my implementation I just called the old .net 1.1 code.

Next step updating the proxy class on the client. This failed. The WSDL importer didn't understand the basicHttpBinding correctly, so the proxy class that was genereated couldn't replace the existing proxy.

After a bit of research I found this blog post.

http://kjellsj.blogspot.com/2006/12/how-to-expose-wcf-service-also-as-asmx.html

This worked, the ASMX WSDL was no different than the old .net 1.1 so everything appered ok.

But it wasn't. When testing the new service I discovered that all my parameters was blank/null on the server. I tried with Fiddler on the client and the parameters is present in the XML that is sent to the server.

So I'm stuck. Any thoughts on how to solve this would be much appreciated. Is there any code that could be interresting to see then let me know.

like image 444
olve Avatar asked Jul 01 '10 07:07

olve


1 Answers

I ran into a similar problem with a web service asmx... certain data was losing their values. If you are using hierarchical data, you may need to declare the internal or inherited objects using an XmlInclude attribute. For example, if you have a User class that is used in your service and a Customer sub class, you may need to declare the Customer class to the service if it is not used directly in a web method. You would do this as follows.

[XmlInclude(typeof(Customer))]
public class Service : WebService

Of course, it may be nothing to do with this, so good luck if that's the case. :)

like image 66
Sheridan Avatar answered Nov 01 '22 03:11

Sheridan