views:

144

answers:

2

I'm trying to convert an ASP.Net web service to WCF application. The client is on the .Net Compact Framework which does not support WCF so I need to make sure the WCF keeps supporting ASP style webservices. When I add the web service reference in Visual Studio the generated proxy class' methods have extra arguments.

For example if a method is defined as:

public void GetEmpInfo(int empNo)

That method will appear in the proxy class as:

public void GetEmpInfo(int empNo, bool empNoSpecified)

What causes this, and how do I get it to stop?

+4  A: 

Check out this blog post ...

Where did these extra boolean “specified” members come from and what do they do? The answer is the schema that the WCF data contract serializer generates by default. Because of the way its versioning model works, the serializer generates all data members as optional elements. The older web services stack, ASP.NET Web Services (“ASMX”), uses a different serializer, the XmlSerializer, which maintains full schema and XML fidelity. The XmlSerializer maps all optional elements to two members: one represents the data itself, and one specifies whether or not the data is actually present – this is the “xxxSpecified” member. These xxxSpecified members must be set to true to enable the serialization of the corresponding “actual data” members.

JP Alioto
FYI, these extra methods are also involved when consuming SOAP 1.2 WSDLs served by Spring-WS in .NET 3.5 .
Glenn Barnett
+1  A: 

The .NET Compact Framework does support a subset of WCF. You can review this support on MSDN. Take a look, it may support enough for you to remove your legacy Web Services support.

Scott Ewers