如何维护Web服务中对象的状态
是否可以将对象发送到 Web 服务并由 Web 服务返回该对象? 通过 Web 服务将对象发送给用户时是否可以维护对象的状态?
有人可以建议一些有助于上述主题的链接吗?
谢谢..
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..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,那是不可能的。
Web 服务受到 HTTP 协议的限制,因此您只能向 Web 服务发送文本(或可能是二进制数据)。
您可以将对象序列化为字符串,但这样做它就不再是对象了。 Web 服务可以将字符串反序列化为新对象,更改它,将该对象序列化为字符串并返回它,以便您可以将其反序列化为另一个对象。您将拥有一个与原始对象类型相同的对象,但它不是同一个对象。
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.
是的,我不明白为什么不,即Web服务方法只能返回相同类型的对象。
“有效”保持/更新其状态。
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.