324.10. 自定义标头和附加过滤

如果您需要提供标题或附加的自定义处理,请扩展现有的 BasicMessageFilter,并覆盖适当方法或编写 MessageFilter 接口的品牌新实施。
要使用自定义过滤器,请将以下内容添加到 spring 上下文中:

您可以按如下方式指定全局一个或多个本地消息过滤器: a)为所有 Spring-WS 端点提供全局自定义过滤器

<bean id="messageFilter" class="your.domain.myMessageFiler" scope="singleton" />

或 b)直接在端点上的本地 messageFilter,如下所示:

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*/ }