WCF Serialization

Please help me out to get this fixed… Its been ages I’m trying to solve this.

I’m writing a wcf service which consumes a third party service as service reference. And this wcf service will be used in a client to send soap xml messages.

While using xml serializer the client code to deserialize an xml file works but some of the properties are null; which worked while using a asmx web service. Please let me know if I’m missing something.

The wcf service is below,

 [ServiceBehavior(Namespace = "http://somethirdparty.com/2011")]
        [SoapDocumentService(ParameterStyle=SoapParameterStyle.Bare)]    
    public class Service : IService
    {        
        [SoapDocumentMethod(ParameterStyle=SoapParameterStyle.Bare)]
        public OTA_HotelResNotifRS ReservationNotification(OTA_HotelResNotifRQ OTA_HotelResNotifRQ)
        {
   ...........

}

[ServiceContract(Namespace = "http://somethirdparty.com/2011")]
    [XmlSerializerFormat]
    public interface IService
    {           
        [OperationContract (Action="http://somethirdparty.com/2011/RS/HotelResNotif")]
        [return: MessageParameter(Name = "OTA_HotelResNotifRS")]
        OTA_HotelResNotifRS ReservationNotification(OTA_HotelResNotifRQ OTA_HotelResNotifRQ);        

    }

The client code is below

LotusResNotifService.OTA_HotelResNotifRQ OTA_HotelResNotifRQ = new LotusResNotifService.OTA_HotelResNotifRQ();

            XmlRootAttribute xRoot = new XmlRootAttribute();
            xRoot.ElementName = "OTA_HotelResNotifRQ";
            xRoot.IsNullable = true;
            xRoot.Namespace = "http://www.opentravel.org/OTA/2003/05";

            XmlSerializer deserializer = new XmlSerializer(OTA_HotelResNotifRQ.GetType(), xRoot);
            StreamReader reader = new StreamReader(@"D:\HotelResNotifRQ_SOAP_RQ.xml");
            object deserialized = deserializer.Deserialize(reader.BaseStream);
            OTA_HotelResNotifRQ = (LotusResNotifService.OTA_HotelResNotifRQ)deserialized;

The OTA_HotelResNotifRQ has some of the properties returned as null…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.