CXF 架构

CXF Architecture 建立在下面的组建之上:

  • Bus
  • Fronted
  • Message and Inteceptor
  • Service Model
  • Data Bindings
  • Protocol Bindings
  • Transport

建构图参考:CXF Architecture.png

1. Bus

    Bus是CXF架构的骨干。CXF Bus由一个Spring配置文件cxf.xml组成,在Servelet初始化期间由SpringBusFactory

    进行加载。cxf.xml定义了一个所有Endpoint的共用上下文环境,将所有的基层运行组建联合起来。SpringBusFactory

    扫描并且加载ClassPath下META-INF/cxf目录下面的配置文件,进行创建Application Context;构建上下文时从下面

    文件进行构建:

    META-INF/cxf/cxf.xml

    META-INF/cxf/cxf-extension.xml

    META-INF/cxf/cxf-property-editors.xml

2. Frontend

    CXF 提供的Fronted Mode,可以使用不同的Fronted API去创建WebService.例如使用:Factory Bean或JAX-WS

    实现。

3. JAX-WS

    是一个用于开发,发布,消费WebService的 规范。

4. Simple frontend

    Simple frontend提供了简单的组件或Java 类使用Reflection来进行构建和发布WebService.例如:

// Build and publish the service
OrderProcessImpl orderProcessImpl = new OrderProcessImpl();
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.setServiceClass(OrderProcess.class);
svrFactory.setAddress("http://localhost:8080/OrderProcess");
svrFactory.setServiceBean(orderProcessImpl);
svrFactory.create();

5. Messaging and Interceptors

    Interceptors是一种组件,用于拦截WebService Client与Server端之间的消息交互和传输,通过拦截器链的方式

    实现。

6. Service model

    Service model用于在WSDL文档中描述一个service, 它提供了用于创建各种WSDL元素的功能,如创建:operations,

    bindings,endpoints,schema等。

7. Data binding

    Data binding用于处理Java对象和XML元素之间的映射。CXF支持两种类型的数据绑定:JAXB和Aegis, CXF默

    认使用JAXB.

8. Protocol binding

    即指定Service's Message使用那种协议进行Bind.例如:

<wsdl:binding name="OrderProcessImplServiceSoapBinding"
type="tns:OrderProcess">
<soap:binding style="document" transport=
"http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="processOrder">
<soap:operation soapAction="" style="document" />
<wsdl:input name="processOrder">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="processOrderResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

     CXF支持的Binding  Protocal:

  •      SOAP 1.1
  •      SOAP 1.2
  •      CORBA
  •      Pure XML

9. Transports

    WSDL文档中Transports作为<port>元素体现的,例如:

<wsdl:service name="OrderProcessImplService">
<wsdl:port binding="tns:OrderProcessImplServiceSoapBinding"
name="OrderProcessImplPort">
<soap:address location="http://localhost:8080/orderapp/
OrderProcess" />
</wsdl:port>
</wsdl:service>  

     CXF支持的Transport:

  •      HTTP
  •      CORBA
  •      JMS
  •      Local

猜你喜欢

转载自springsfeng.iteye.com/blog/1632439
CXF