I have already configured my service reference and have set up my archive in Generic.List.
When I list & lt; Objects & gt; with a string or int, it works fine
There is a way to do this, but when I call it list & lt; String & gt; , it returns a runtime error
list & lt; Objects & gt; Pass which contains many lists for WCF
Windows Communication Foundation (WCF) In XML, you can use two different serialization technologies to turn data into your app
Data Contrast Serializer as the default:
By default, WCF uses the Data Contraceciler class to serial data types. This serializer supports the following types: The primitive type (for example, integer, string, and byte arrays), as well as some special types such as XML Element and Datetime, which are considered as priority.
Data Contract Type (type marked with DataContractAttribute attribute)
The type is marked with SerializableAttribute attribute, which contains the type that implements the ISerializable interface.
The types of implementing the IXmlSerializable interface.
Many common collection types, which include many common collection types.
Many .NET frame types come in the latter two categories and are thus serial. Sequence of serial types are also ordering For a complete list, see Specifying Data Transfer in Service Agreements. Data Contractsliser, which is used in conjunction with the data contract type, is the recommended method of writing new WCF services. For more information, see Using Data Contracts.
When using the XmlSerializer class:
WCF also supports the XmlSerializer class. The XmlSerializer class is not unique to WCF, it is the only serialization engine that uses ASP.NET web services. The XmlSerializer class supports a lot of compressed types compared to the DataContractSerializer class, but allows more control over the resulting XML and supports more of the XML Schema Definition Language (XSD) standard. No declaratory characteristics are required on serial types. For more information, see the XML serialization topic in the .NET Framework Document. XmlSerializer class does not support data contract types To create client code for third-party service, or to access third-party schema When using the Svcutil.exe or service reference feature in Visual Studio, a suitable serializer Automatically selected for you. If the schema is not compatible with DataContractSerializer, then XmlSerializer is selected.
Manually switch to XmlSerializer:
Many times, you may need to manually switch to XmlSerializer For example, in the following cases In this, it happens: When you migrate an application to WCF from ASP.NET web services, you may want to reuse existing, XML serializer-compatible type instead of creating new data contract types.
When precise control over XML is important in messages, but a Web Services Design Language (WSDL) document is not available, for example, when it is necessary to comply with a specific standardized, published schema DataContractSerializer Compatible with.
When legacy builds services that follow the SOAP encoding standard.
In these and other cases, you can manually change the XmlSerializerFormatAttribute attribute to the XmlSerializerFormatAttribute attribute, as shown in the following code. [XmlSerializerFormat] Public category banking service {[OperationContract] Public Zero Process Transactions (BankingTenation BT) {// Code N OT}} // Banking Transaction: A Data The contract is not class, but instead there is an XmlSerializer-compatible class. Public class banking transaction {{XmlAttribute} public string operation; [XmlElement] account from public account; [XmlElement] Public Account to ACC; [XmlElement] Public int amount; } // Notice that the account class should have XML Serializer-compatible.
Comments
Post a Comment