Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are there extra arguments in my wcf web service reference?

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?

like image 439
Mykroft Avatar asked Jun 15 '09 18:06

Mykroft


1 Answers

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.

like image 157
JP Alioto Avatar answered Sep 28 '22 09:09

JP Alioto