ESB (三) 整合跨平台、异构系统的Web Service服务

1.mule ESB整合系统四种模式

A.简单服务模式



属于几个web Service之间的同步调用,请求响应处理模式。

B.桥接模式



C.校验器模式



       校验器模式通过定义一个校验过滤器过滤服务请求,并同步返回ACK(ACKnowledge)或NACK(Not Acknowledge)结果。通过校验的服务请求被异步分发给处理方。

D.服务代理模式



       在整合时我们用到的是D模式,中间设置一个代理来中转请求处理,对外发布的地址任意很灵活,当提供者的Web service发生改变的时候就不需要在更改服务使用者的代码,相当于解耦的作用。

2.*.flow图形文件设计


对应的代码流程为:
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
    <flow name="webservice_proxy_test" doc:name="webservice_proxy_test">
        <http:inbound-endpoint exchange-pattern="request-response" address="http://192.168.24.39:8888/abc" doc:name="HTTP"/>
        <cxf:proxy-service namespace="http://webservice.test.com/" service="helloService123" payload="body" wsdlLocation="http://192.168.24.82:8888/Web_Service_Spring/ws/helloService789?wsdl" doc:name="SOAP"/>
        <cxf:proxy-client payload="body" enableMuleSoapHeaders="true" doc:name="SOAP"/>
        <http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://192.168.24.82:8888/Web_Service_Spring/ws" doc:name="HTTP"/>
    </flow>
</mule>
       打包完发布,将esb单独部署到一台服务器上,也可以减少其它服务器的压力,使得请求通过esb服务器中专。
其中<http:inbound>标签表示其它系统调用ESB的地址,即ESB对外发布的访问地址,<http:outbound>表示esb调用其它系统地址,服务提供者地址。
       mule ESB是一个消息框架,用于应用程序之间的数据交互,各种应用被ESB封装为了服务transport使得服务之间的数据可以交互,并且数据在transport在传输过程中进行了数据格式转换。
       mule ESB很好的解决了各个系统、各个平台、各种复杂系统之间的交互问题,除了对Web service支持外还支持多种如jms、ftp、json、xml、rmi等传输协议。
       下一篇即将通过esb调用JMS消息服务使得各个系统可以异步通信。




posted @ 2014-12-02 12:20  李龙生的博客  阅读(2853)  评论(0编辑  收藏  举报