mule學習筆記(八):代理方式調用服務

<?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:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xmlns:ws="http://www.mulesoft.org/schema/mule/ws"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ws http://www.mulesoft.org/schema/mule/ws/3.1/mule-ws.xsd
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/current/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.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">
      <!--  遠程調用發佈的webservice方法一
      調用結果:不報錯,瀏覽器輸出“Directory Listing Denied This Virtual Directory does not allow contents to be listed.”-->
 <!--       <flow name="HttpProxyService" doc:name="HttpProxyService">
         <http:inbound-endpoint exchange-pattern="request-response" encoding="UTF-8" address="http://localhost:8880" doc:name="HTTP"/>
         <http:outbound-endpoint exchange-pattern="request-response" encoding="UTF-8" address="http://webservice.webxml.com.cn?op=getWeather" doc:name="HTTP" method="GET"/>
         </flow>
  -->  
         <!-- 遠程調用發佈的webservice方法二
             調用結果:success!
             其中"?op=getWeather"指明調用方法名。
             參考資料:http://www.mulesoft.org/documentation/display/34X/Web+Service+Proxy+Pattern-->
      <pattern:web-service-proxy name="muleProxy" inboundAddress="http://localhost:8881"
      outboundAddress="http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?op=getWeather">
      </pattern:web-service-proxy>
 
     
      <!-- 遠程調用發佈的webservice方法三
                 調用結果:success!-->
 <!--       <ws:proxy name="mule-Ws-Proxy" inboundAddress="http://localhost:8882"
        outboundAddress="http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?op=getWeather" />
  -->
      
      
    
       
</mule>


<!--使用說明:這是一個服務代理的例子,被代理的服務是“http://localhost:8888”,是一個已經發布的web Service(他可以是發佈在本地服務器上的服務
,也可以是發佈在遠程服務器上的服務,總之,只要是義發佈的web Service就可以),本文中是發佈在Standalone server中(路徑:D:\mule-standalone-3.4.0\apps\mule-example-hello-3.4.0),
服務“http://localhost:8880”是發佈在esb平臺上的代理服務。
參考資料:http://www.360doc.com/content/11/0322/15/2795334_103545455.shtml
目的:通過esb平臺上的代理服務來訪問第三方web Service-->

<!-- 說明2:原有例子採用方法一,outbound-endpoint address爲發佈在Standalone serve中的服務訪問地址(http://localhost:8888)。使用時需要先啓動mule Standalone serve。
現修改爲多種配置方法代理遠程服務。方法2、3需要增加對應namespace(現已全部加入),否則出現not bound錯誤。
參考資料:http://www.oschina.net/question/1467716_146853?sort=time -->

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章