2013-03-03 68 views
1

我用騾子CE 3.3.0。我的項目有以下幾點:在CXF服務請求數的

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" 
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" 
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security" 
xmlns:ss="http://www.springframework.org/schema/security" 
xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.3.0" 
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.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.3/mule-spring-security.xsd 
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.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 
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd "> 

<global-property name="allowed" value="192.168.3.76,192.168.3.74,192.168.3.75" /> 

<configuration> 
    <expression-language> 
     <global-functions> 
      def parseIp(fullIp) { 
      return fullIp.substring(fullIp.indexOf('/') + 1, fullIp.indexOf(':')) 
      } 
    </global-functions> 
    </expression-language> 
</configuration> 

<http:connector name="httpConnector" doc:name="HTTP\HTTPS"> 
    <service-overrides sessionHandler="org.mule.session.NullSessionHandler" /> 
</http:connector> 

<mule-ss:security-manager> 
    <mule-ss:delegate-security-provider 
     name="memory-dao" delegate-ref="authenticationManager" /> 
</mule-ss:security-manager> 
<spring:beans> 
    <ss:authentication-manager 
     xmlns:ss="http://www.springframework.org/schema/security" alias="authenticationManager"> 
     <ss:authentication-provider> 
      <ss:user-service id="userService"> 
       <ss:user name="weather" password="weather" authorities="ROLE_ADMIN" /> 
      </ss:user-service> 
     </ss:authentication-provider> 
    </ss:authentication-manager> 
</spring:beans> 

<flow name="OML_News" doc:name="OML_News"> 
    <http:inbound-endpoint host="localhost" port="9091" 
     path="iran/oml_news" exchange-pattern="request-response" doc:name="HTTP"> 
    <mule-ss:http-security-filter realm="mule-realm" /> 
    </http:inbound-endpoint> 
    <expression-filter 
     expression="#['${allowed}'.contains(parseIp(message.inboundProperties['MULE_REMOTE_CLIENT_ADDRESS']))]" 
     doc:name="Expression" />   

    <cxf:proxy-service 
     service="Weather" 
     wsdlLocation="http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl" 
     namespace="http://ws.cdyne.com/WeatherWS/" 
     validationEnabled="true" doc:name="SOAP"> 
    </cxf:proxy-service> 

    <copy-properties propertyName="SOAPAction" doc:name="Property" /> 

    <cxf:proxy-client doc:name="SOAP" /> 

    <outbound-endpoint 
     address="http://wsf.cdyne.com/WeatherWS/Weather.asmx" 
     exchange-pattern="request-response" doc:name="Generic"> 
    </outbound-endpoint> 

</flow> 

我發動CXF服務。有些客戶在我的cxf服務中使用wsdl地址,他們實現了web服務。現在我希望可以確定有多少用戶使用我的wsdl地址,並且每個用戶都有多少請求發送到我的服務器?實際上,我想創建一個報告系統。

回答

1

有幾種方法可以做到這一點,例如您可以在HTTP入站端點後添加一個竊聽和調用,要麼收集統計信息在數據庫中或更優雅的調用,它這個流程的自定義組件。

<http:inbound-endpoint address="http://yourendpointaddress:8080/path" /> 
<wire-tap> 
    <vm:outbound-endpoint path="stats" /> 
</wire-tap> 

然後

<flow name="statsFlow"> 
    <vm:inbound-endpoint path="stats" /> 
    <!-- gather stats from the headers --> 
    <jdbc:outbound-endpoint queryKey="insertStatsIntoDB" /> 
</flow> 

這應該收集統計信息,而不會影響性能。

+0

感謝@Juan,當我直接用我的WSDL地址,這個解決方案正常工作,但是當我創建了一個門戶以「WSDL」作爲Web服務,並在我的門戶部署,該解決方案不起作用,我的統計是錯誤。因爲我想要一個確切的統計數據,請求我的portlet使用我配置的MULE – 2013-03-04 09:05:12

+0

中的WSDL,你能幫助我嗎? – 2013-03-06 05:54:21