We're trying to consume a web service (Soap) and have generated an adapter for the schema using SvcUtil.exe. We have a field
recurrenceCount
which should not be provided unless it has a value and so we have added a property
recurrenceCountSpecified
as according to MSDN . Even though recurrenceCountSpecified is false, the field recurrenceCount property is still specified in the outgoing xml.
What are we doing wrong ?
Adapter code :
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel","3.0.0.0")] [System.ServiceModel.ServiceContractAttribute(Namespace="http://sas.elluminate.com/", ConfigurationName ="SASDefaultAdapterV2Port")]
public interface SASDefaultAdapterV2Port
{
[System.ServiceModel.OperationContractAttribute(Action="http://sas.elluminate.com/setSession",ReplyAction = "*")]
[System.ServiceModel.FaultContractAttribute(typeof(sas.elluminate.com.ErrorResponse), Action = "http://sas.elluminate.com/setSession", Name="ErrorResponse")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
sessionResponseCollection setSession(setSessionRequest request);
}
The modified class is :
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel","3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="setSession", WrapperNamespace = "http://sas.elluminate.com/",IsWrapped = true)]
public partial class setSessionRequest
{
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool recurrenceCountSpecified;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://sas.elluminate.com/", Order = 19)]
public int recurrenceCount;
}