SOAP Web 服务:响应中的对象别名?
如果 Web 服务返回一个对象图,其中某些对象多次出现,那么有关这些对象的数据是否一定会在传输格式中重复?
换句话说:使用 Java 序列化,每个对象的状态仅写入一次,对该对象的后续引用只是序列化流中的指针。当(取消)编组 Web 服务请求或响应时,是否有一种(优选的便携式,即符合 WI-Basic-Profile 标准)方法来实现相同的目的?
示例:给定类
class Project {
Task[] tasks;
}
class Task {
User assignee;
}
class User {
// some data
}
Web 服务应该返回一个 Project
,并且我想最多向每个 User
发送一次,无论他分配了多少任务该项目。
If a web service returns an object graph where some objects appear multiple times, will the data about these objects necessarily be duplicated in the transport format?
Put differently: With Java serialization, each object's state is written only once, and subsequent references to that object are mere pointers within the serialization stream. Is there a (preferable portable, i.e. WI-Basic-Profile compliant) way to achieve the same when (un)marshalling a webservice request or response?
Example: Given the classes
class Project {
Task[] tasks;
}
class Task {
User assignee;
}
class User {
// some data
}
The webservice is supposed to return a Project
, and I'd like to send each User
at most once, regardless of how many tasks he is assigned in the project.
SOAP 似乎可以使用
encodingStyle
序列化对象图,但使用encodingStyle
与 WS-I Basic Profile 1.1 相矛盾。 (来源)It appears that SOAP can serialize object graphs by using
encodingStyle
, but usingencodingStyle
contradicts WS-I Basic Profile 1.1. (source)