From this article you will understand which the limitations are and what information your code can accept (in the form of values) and return (in the form of a return value) before you transform your class into a web service. Because web services in ASP.NET world, are executed by ASP.NET, which hosts the CLR, you can use any valid .NET code. For example you can validate date with regular expressions and you can use .NET classes to access data with ADO.NET. However, there are limitations, because web services are built on XML-based standards for exchanging data.  As a result, the set of data types web services can use is limited to the set of data types recognized by the XML Schema standard. You can use simple data types such as strings and numbers, but there is no automatic way to send proprietary .NET objects such as an Image,   a FileStream, etc. In other words, other programming languages have no way to interpret these more complex classes.

 

The next table presents web services data types for parameters and return values.

 

Data Type

Description

The basics

Simple data types such as integers (defined in C# with short, int, long keywords and in VB.NET with Short, Integer and Long keywords), unsigned integers (defined in C# with ushort, uint, ulong keywords and in VB.NET with UShort, UInteger and ULong), nonintegral numeric types (defined in C# with float, double, decimal keywords and in VB.NET with Single, Double and Decimal keywords), and a few other miscellaneous types (defined in C# with bool, string, char, byte, and DateTime keywords and in VB.NET with Boolean, String, Char, Byte, and DateTime keywords).

Arrays

You can use arrays of any supported type. You can also use an ArrayList (which is simply converted into an array), but you can’t use more specialized collections such as the Hashtable. You can also use binary data through byte arrays. Binary data is automatically Base64 encoded so that it can be inserted into an XML web service message.

Custom Objects

You can pass any object you create based on a custom class or structure. The only limitation is that only public data members are transmitted, and all public members and properties must use one of the other supported data types. If you use a class that includes custom methods, these methods will not be transmitted to the client, and they will not be accessible to the client.

Enumerations

Enumerations types (defined in C# with the enum keyword and in VB.NET with the Enum keyword) are supported. However, the web service uses the string name of the enumeration value (not the underlying integer).

XmlNode

Objects based on System.Xml.XmlNode are representations of a portion of an XML document. You can use this to send arbitrary XML.

DataSet and DataTable

You can use the DataSet and DataTable to return information from a relational database. Other ADO.NET data objects, such as DataColumns and DataRows, aren’t supported. When you use a DataSet or DataTable, it’s automatically converted to XML in a similar way as if you had used the GetXml() or WriteXml() method.

 

Another important requirement is that your web services should be stateless. In fact, the web service architecture works in the same way as the web-page architecture—a new web service object is created at the beginning of the request, and the web service object is destroyed as soon as the request has been processed and the response has been returned.