Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Services (http://www.velocityreviews.com/forums/f64-asp-net-web-services.html)
-   -   Returning Objects (http://www.velocityreviews.com/forums/t787770-returning-objects.html)

SS IT Services LLC 12-19-2008 03:23 PM

Returning Objects
 
Is it a bad practice to return strong typed class objects from my
webservice?

If so, what is the preferred option.


--
Scott
SS IT Services, LLC


John Saunders 12-21-2008 09:39 PM

Re: Returning Objects
 
"SS IT Services LLC" <ssitservicesllc@gmail.com> wrote in message
news:215F5425-2205-4BA5-9F87-6217E280DBE6@microsoft.com...
> Is it a bad practice to return strong typed class objects from my
> webservice?
>
> If so, what is the preferred option.


No. That's the preferred option, assuming you understand what it means.
Although you will be _returning_ those types, you will not be _sending_
them, and your clients will not be _receiving_ them.

When you return any type, including a primitive type like string, you will
be sending XML back to the client. In many cases, the client will
deserialize this XML into an instance of some proxy type - a type that makes
it easier for the client to access the deserialized XML. This will not be
the same type you sent, so that type will not have any of the methods of
your original type.

Also, you should not return platform-specific types, as those types may well
not exist on the platform being used by the client. In particular, do not
return DataSet or DataTable.

John




All times are GMT. The time now is 05:42 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.