WS调用中对象的生命周期
当 Java 对象被传递到 SOAP Web 服务并在修改后返回时,它的生命周期会发生什么?我知道它被序列化、mar-shelled、转换为 XML 等。但我不确定顺序。
What happens to a Java object's life when it is passed to a SOAP web service and returned after modification? I know it is serialized, mar-shelled, converted to XML etc. But i am not sure about the sequence.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常从生成的对象开始,该对象的类用 XML 注释进行修饰。用数据填充对象后,将其作为参数传递给 Web 服务方法。 JAX-WS 库将使用 JAXB 和对象上的注释将其编组为 XML、打包为 SOAP 消息,并通过网络将其发送到 Web 服务端点。
在服务器端,SOAP 消息被分解,对象 XML 被解组。此时,方法逻辑执行并提供返回值。如果该返回值是另一个 XML 可序列化对象,我们将再次执行整个过程来编组并发送响应。
You usually start with a generated object whose class is decorated with XML annotations. After filling your object with data, you pass it as a parameter to a web service method. The JAX-WS libraries will use JAXB and the annotations on your object to marshal it into XML, pack it into a SOAP message, and send it over the network to a web service endpoint.
On the server side, the SOAP message is disassembled and the object XML is unmarshaled. At this point, the method logic executes and provides a return value. If that return value is another XML serializable object, we go through the whole process again to marshal and send the response.