自从JavaEye将CXF2.0发布的消息置顶之后,我一下收到好几个朋友的来信,他们除了对CXF使用表现了极大兴趣以外,也对CXF以及JAXWS的具体实现表现出了很大的热忱。
下面是他在信中提的几个问题:
“如何才能够学好web services呢?
不仅仅是熟悉cxf这样的框架,而是真正了解和掌握,包括协议细节,传输过程,以及设计合理的web services甚至开发自己的简单webservices框架。
不知您对以上过程有什么建议呢?有没有什么推荐的学习蓝图?”
对于第一个问题,真的很难回答,我想很多人都有自己的答案。
我们先从第二个问题开始,下面是我摘抄自 SOA: Using Java Web Services 第一章中的有关服务器和客户端消息通讯流程中的相关重要步骤,希望能对大家学习 Web Services 有所帮助。
有关学习Web Services 的学习蓝图请参见我的另一篇Blog Web Services学习资源
服务端调用
1. Receiving a SOAP message from a transport
2. Invoking handlers that preprocess the message
3. Determining the message’s target service
4. Determining the Java target is referred to as dispatching
5. Deserialize the message into Java objects ( paramenters)
6. Invoking the Java target using the paramenters and getting the Java object retruned by the target method
7. Serialize the retrun object into an XML element
8. Wrapping the retruned XML element as a SOAP message response
9. Handing the SOAP response back to the transport for delivery
客户端的调用
1. Creating an instance of the Web service endpoint which is implementing the SEI (Service Endpoint Interface).
[SEI instances are implemented using Java proxies and invocation handlers]
2. Handling an invocation of the SEI instance
3. Taking the paramenters passed to the SEI and serialized them into XML elements
4. Wrapping the paramenter elements in a SOAP message
5. Invoking handlers that post-process the message
6. Handing off the message to the transport for delivery
7. Receiving the SOAP message response from the transport
8. deserialized the message into a Java object that is an instance of the class specified by the SEI's return type.
9. Completing the invocation of the SEI by retruning the deserialized SOAP response