none
DataContract is not getting deserialized by WCF service when using XmlSerializerFormat RRS feed

  • Question

  • SOAP message sent by the 3rd party client to WCF service is in the format given below , which cannot change.
     
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://asf.mynamespace.it/pic2ssdc" xmlns:types="http://asf.mynamespace.it/pic2ssdc/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
        <To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://127.0.0.1:8001/</To>
        <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://asf.mynamespace.it/pic2ssdc/SendSignal</Action>
      </s:Header>
      <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <tns:SendSignal>
          <segnaleVita href="#id1" />
        </tns:SendSignal>
        <tns:SignalSSDC id="id1" xsi:type="tns:SignalSSDC">
          <codGCMMitt xsi:type="xsd:int">7</codGCMMitt>
          <numSezioneMitt xsi:type="xsd:int">12</numSezioneMitt>
          <dtGenerazione xsi:type="xsd:dateTime">2013-04-22T03:23:35.3405058+02:00</dtGenerazione>
        </tns:SignalSSDC>
      </soap:Body>
    </soap:Envelope>

    Service Contract :
        [ServiceContract(Namespace = "http://asf.mynamespace.it")]
        [XmlSerializerFormat]
        public interface pic2ssdc
        {
            [OperationContract]
            SendSegnaleVitaResult SendSignal(SignalSSDC segnaleVita);
        }

    DataContract used is :

        [DataContract]
        [Serializable]
        [XmlRoot("SignalSSDC")]
        public class SignalSSDC 
        {
            [DataMember]
            [XmlAttribute]
            public String id
            {
                get;
                set;
            }

            [DataMember]
            [XmlElement]
            public int codGCMMitt
            {
                get;
                set;
            }
            [DataMember]
            [XmlElement]
            public int numSezioneMitt
            {
                get;
                set;
            }
            [DataMember]
            [XmlElement]
            public DateTime dtGenerazione
            {
                get;
                set;
            }
        }

    when the call is received by WCF service the parameter passed is null 
       public class PIC2SSDCImp : pic2ssdc
        {
            public PIC2SSDCImp()
            {
              
            }
            public SendSegnaleVitaResult SendSignal(SignalSDDC segnaleVita)
            {
              //segnaleVita is null .. the value is not deserialized..

            }
         }
    why is the datacontract value not deserialized and how do i fix this?

    mamatha

    Wednesday, May 29, 2013 8:28 AM

Answers