0

Is it possible to send the object to the web service and the web service returns the object? is it possible to maintain the state of the object while sending it to the user through web service?

can anybody suggests some links which helps the above topic?

thanxs..

priyanka
  • 543
  • 4
  • 10
  • 18
  • Could you clarify the question? – Paulo Santos Mar 27 '11 at 09:49
  • The best way to keep state is to put in into a persistent store, e.g. a database – marc_s Mar 27 '11 at 09:51
  • i want to create a web service which takes object of a particular class & that time some properties of that class might be set by the user. then this web service should return the same class object with the property value which is set by the user. – priyanka Mar 27 '11 at 09:54

2 Answers2

0

Yes,I dont see why not, ie the web service method can just return an object of the same type. "Effectively" keeping/updating its state.

Mark Redman
  • 24,079
  • 20
  • 92
  • 147
0

No, that is not possible.

A web service is limited by the HTTP protocol, so you can only send text (or possibly binary data) to and from a web service.

You can serialise the object into a string, but by doing that it's not an object any more. The web service can deserialise the string into a new object, change it, serialise that object into a string and return it, so that you can deserialise it into yet another object. You will have an object that is the same type as the original, but it's not the same object.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005