What are the datatypes that can be returned by webservices and web methods?
+1
A:
Web services can return pretty much any serializable data type. It does it by returning the data in XML in the form of a SOAP message. What are you trying to acheive?
Keith
2009-07-20 11:12:48
can i return DataAdapter,DataReader,Dataset from a wbeservice?
Loganathan
2009-07-20 11:18:59
Technically you can but it depends on what is consuming your web service. If you're working on an in-house system where the consumer is a .net app then fine, but otherwise it would be best to create your own data structure that uses, strings, ints and arrays etc
Keith
2009-07-20 11:53:41
+1
A:
Exactly which types can be returned depends on whether you're using WCF or the legacy ASMX web services.
In either case, you should never return a platform-specific type (like DataReader or DataSet). Even if it's physically possible to do it, it's a bad idea. Even if today, your service will only be called by .NET code, tomorrow it may need to be called by Java or something else you cannot anticipate. Naturally, Java won't know what to do with a type that is specific to the .NET Framework!
John Saunders
2009-07-20 11:24:57
I think then it is a better idea to return and object array..it is correct?
Loganathan
2009-07-20 11:30:32
Instead of what? No, don't return object[]. It tells the caller nothing about what the data are.
John Saunders
2009-07-20 11:33:33