I am developing a WCF service using VSTS 2008 + .Net 3.5 + C# and it works fine when I also use VSTS 2008 to develop client (using Add Service Reference function to automatically generated client web services proxy code). The WCF I developed is using basicHttpBinding.
The issue I met with is, when I use Visual Studio.Net (Visual Studio 2003) to generate client web services proxy code, there is an additional input parameter for a OperationContract method called IdSpecified (bool type). I have tested that when specify IdSpecified to true, the value of Id parameter will be passed to WCF server side correctly, but when I specify IdSpecified to false, no matter what values I specify to Id parameter, at WCF server side, Id will be always 0. I also tried for input parameter type like string, there is no such additional input parameter at client side.
My question is why there is an additional parameter? What is its meaning and is it possible to avoid generate such additional parameter?
Here is Visual Studio.Net automatically generated client side web services proxy code,
public StudentInfo Poll(int Id, [System.Xml.Serialization.XmlIgnoreAttribute()] bool IdSpecified)
Here is my VSTS 2008 WCF server side code,
[OperationContract]
StudentInfo Poll(int Id);
EDIT 1: here is part of the automatically generated code at client side about Poll method.
[return: System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public StudentInfo Poll(int Id, [System.Xml.Serialization.XmlIgnoreAttribute()] bool IdSpecified) {
object[] results = this.Invoke("Poll", new object[] {
Id,
IdSpecified});
return ((StudentInfo)(results[0]));
}