如何在发送介体中使用自定义模块?

问题描述 投票:0回答:1

我正在尝试为我的安全请求的传入响应禁用WS-Security。此类请求由发送中介者中的Policy保护:

<send>
  <endpoint>
    <address format="soap11" uri="${endpoint}">
      <enableSec policy="conf:policies/Policy.xml" />
    </address>
  </endpoint>
</send>

为了在传入消息上禁用WS-Security,我遵循了本文SOA Security - Disabling WS-Security for IN or OUT messages in Axis2。它使用自定义模块来替换策略文件以进行消息验证。为了编写自定义模块并将其纳入我的服务中,我遵循了WSO2文档中的Writing an Axis2 ModuleEngaging Module

如果我通过在axis2.xml中添加nosecurity模块来全局启用该模块,则它可以像它应该的那样对每个传入消息起作用。

<!-- ================================================= -->
<!--             Global Engaged Modules                -->
<!-- ================================================= -->

<!-- Comment this out to disable Addressing -->
<module ref="addressing"/>
<module ref="nosecurity"/>

但是我不知道如何只为发送调解器使用该模块。从Engaging Module使用此代理时,它仅使用模块来处理对该代理的传入请求,而不会使用我通过Send Mediator向端点发出的呼叫响应。

<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="Pass"
       transports="http,https"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
  <target>
    <inSequence>
      <send>
        <endpoint>
          <address format="soap11" uri="${endpoint}">
            <enableSec policy="conf:policies/Policy.xml" />
          </address>
        </endpoint>
      </send>
    </inSequence>
    <outSequence>
      <send/>
    </outSequence>
  </target>
  <parameter name="engagedModules">nosecurity</parameter>
</proxy>

所以我的问题是,如何仅针对发送介体使用我的自定义Axis2模块?谢谢您的投入。

wso2 wso2esb wso2ei
1个回答
0
投票
您也可以在服务级别使用模块。请在[1]上选中

以服务级别使用模块[1] https://docs.wso2.com/display/EI640/Working+with+Modules#WorkingwithModules-Engagingmodules

© www.soinside.com 2019 - 2024. All rights reserved.