MULE CE 3.3.0中所有请求的IP地址日志文件? [英] IP-addresses Log file by all requests in MULE CE 3.3.0?
问题描述
我要实现此过程:
1-邮局提供了将邮政编码提供给客户的服务。因此,邮局为其服务创建了WSDL文件。
1- Post- office has a service for giving postal-code to clients. So post-office creates a WSDL-file for its service.
2-在这里,我们公司是邮局与客户之间的连接者。我们公司使用m子,并根据邮局的WSDL文件创建了另一个WSDL文件,并发布了WSDL供客户使用。
2- Here, our company is a connector between post-office and clients. Our company using mule and create another WSDL file based on post-office’s WSDL file and published out the WSDL for client usage.
3- Company-A和Company-B,获取WSDL文件的URL,例如在My-eclipse IDE或任何其他IDE中创建一个portlet,并将其作为Web服务部署在liferay门户中,以向其客户端显示邮政编码。
3- Company-A and Company-B, get the WSDL-file URL and for instance in My-eclipse IDE or any other IDEs create a portlet and deploy it in a liferay portal as a web-service for displaying postal-code to its clients.
在此过程中,我希望拥有ip地址的日志文件。这意味着,我想在公司A的客户或公司B的客户发送到服务器(我们公司)的每个请求之后,将Ip地址插入数据库或文件中。
During this process I want to have a log file of ip-addresses. It means, I want to after each request that Company-A’s client or Company-B’s client sent to the server(Our company), it’s Ip-address insert into a database or in a file.
我用红色箭头表示了我在图像中的位置。现在,我想在MULE服务器中放置一个脚本,并收集使用邮政编码Web服务的Company-A和Company-B的所有IP地址。
I illustrated my position in the image by a red Arrow. Now I want to put an script in MULE server that and gather all the ip addresses that Company-A's and Company-B's customers who use post-code webservice.
我可以吗?为此问题使用 cxf-interceptor 吗?如何?
Can I use cxf-interceptor for this issuse ? and how? guide me?
推荐答案
正如genjosanzo在 https://stackoverflow.com/a/15993127/387927 ,您可以访问CXF拦截器中的所有Mule标头。这意味着是的,您可以使用CXF拦截器实现目标。
As genjosanzo has suggested in https://stackoverflow.com/a/15993127/387927, you can access all the Mule headers in a CXF interceptor. This means that yes, you can achieve your goal with a CXF interceptor.
Here is an example of such an interceptor: https://github.com/mulesoft/mule/blob/mule-3.3.1/modules/cxf/src/main/java/org/mule/module/cxf/support/MuleHeadersInInterceptor.java
这里是一个配置示例,显示了如何使用Spring实例化和配置CXF拦截器: https://github.com/mulesoft/mule/blob/mule-3.3.1/modules/cxf/src/test /resources/header-conf.xml
Here is a configuration sample that shows how to use Spring to instantiate and configure CXF interceptors: https://github.com/mulesoft/mule/blob/mule-3.3.1/modules/cxf/src/test/resources/header-conf.xml
要点是:
<cxf:inInterceptors>
<spring:bean id="foo1" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
</cxf:inInterceptors>
这篇关于MULE CE 3.3.0中所有请求的IP地址日志文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!