325.10. 自定义标头和附加过滤
如果您需要提供标头或附加的自定义处理,请扩展现有的 BasicMessageFilter,并覆盖适当的方法或写入 MessageFilter 接口的品牌新实施。
要使用您的自定义过滤器,请将其添加到 spring 上下文中:
您可以按如下指定全局自定义过滤器:a)全局自定义过滤器,为所有 Spring-WS 端点提供全局配置
<bean id="messageFilter" class="your.domain.myMessageFiler" scope="singleton" />
<bean id="messageFilter" class="your.domain.myMessageFiler" scope="singleton" />
或 b)直接在端点上的本地 messageFilter,如下所示:
to("spring-ws:http://yourdomain.com?messageFilter=#myEndpointSpecificMessageFilter");
to("spring-ws:http://yourdomain.com?messageFilter=#myEndpointSpecificMessageFilter");
如需更多信息,请参阅 CAMEL-5724
如果要创建自己的 MessageFilter,请考虑在类 BasicMessageFilter 中的默认 MessageFilter 实现中覆盖以下方法:
protected void doProcessSoapHeader(Message inOrOut, SoapMessage soapMessage) {your code /*no need to call super*/ } protected void doProcessSoapAttachements(Message inOrOut, SoapMessage response) { your code /*no need to call super*/ }
protected void doProcessSoapHeader(Message inOrOut, SoapMessage soapMessage)
{your code /*no need to call super*/ }
protected void doProcessSoapAttachements(Message inOrOut, SoapMessage response)
{ your code /*no need to call super*/ }