Returning Objects

S

SS IT Services LLC

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

If so, what is the preferred option.
 
J

John Saunders

SS IT Services LLC said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top