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消息服務使得各個系統可以異步通信。





免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM