I am consuming a WCF in a classLibrary by adding a web reference of the WCF service.
All the classes of service are showing, their is no build error.
But when calling the method of service, getting the below mentioned error:-
And I am passing a object in the method which contains the xml.
But when I am making a proxy class by using svcutil.exe ,then call the method of service with the same object having same xml no error is coming, it is working fine.
_**It means that in classLibrary we can consume a WCF service only by creating a proxy not by adding the web reference of the WCF service.
Is the above statement is correct or not?
If not then please provide a solution for it.**_
**Error:
System.InvalidOperationException: There is an error in XML document (1, 528). ---> System.InvalidOperationException: Instance validation error: '' is not a valid value for PropertySubType.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderHotelFlow.Read29_PropertySubType(String s)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderHotelFlow.Read30_Hotel(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderHotelFlow.Read31_SearchResult(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderHotelFlow.Read100_SearchHotelsResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer8.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at ClassLibTestTouricoWCFinCsharp.com.touricoholidays.demo2.HotelFlow.SearchHotels(SearchRequest request) in C:\Documents and Settings\Prakash.singh\My Documents\Visual Studio 2005\Projects\ClassLibTestTouricoWCFinCsharp\ClassLibTestTouricoWCFinCsharp\Web References\com.touricoholidays.demo2\Reference.cs:line 132
at ClassLibTestTouricoWCFinCsharp.Class1.test() in C:\Documents and Settings\Prakash.singh\My Documents\Visual Studio 2005\Projects\ClassLibTestTouricoWCFinCsharp\ClassLibTestTouricoWCFinCsharp\Class1.cs:line 78**