2013-03-03 70 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