I am using a SOAP service that was imported as a service reference in VS2010. I call one of the services with the request object provided by the service. The problem I am facing is that not all properties of the object are serialized or, rather, are not sent over the wire. The request object is as follows:
var serviceRequest = new UpdateRequest{ StoreId = request.StoreId, Id = request.Id, Status = (Status)Enum.Parse(typeof(Status), request.myStatus.ToString()), parameters = request.Parameters, validFrom = request.ValidFrom.Value, validFromSpecified = request.ValidFromSpecified };
And that’s what was sent over the wire. I captured it using wirehark
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <updateStore xmlns="http://localhost.service.com/"> <StoreRequest> <StoreId>1234</StoreId> <validFrom>2011-11-29T00:00:00</validFrom> <parameters> <param1>true</param1> </parameters> </StoreRequest> </updateStore> </s:Body> </s:Envelope>
Two parameters, Id and Status, were not sent to the service, and I just cannot understand why. The values are set and the generated WSDL properties are publicly available and have the same serialization attributes as the serializable properties.
Any help would be appreciated.
Edit ---- Updated with generated service code
/// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.233")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://myservice.com/")] public partial class StoreUpdateRequest : object, System.ComponentModel.INotifyPropertyChanged { private long StoreIdField; private long IdField; private bool IdFieldSpecified; private Status StatusField; private bool StatusFieldSpecified; private long storeIdField; private bool storeIdFieldSpecified; private System.DateTime validFromField; private bool validFromFieldSpecified; private System.DateTime validToField; private bool validToFieldSpecified; private technicalParameters parametersField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Order=0)] public long StoreId { get { return this.StoreIdField; } set { this.StoreIdField = value; this.RaisePropertyChanged("StoreId"); } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Order=1)] public long Id { get { return this.IdField; } set { this.IdField = value; this.RaisePropertyChanged("Id"); } }
Gargamel
source share