我正在尝试将多个安全策略应用于 WSO2 ESB 4.0.3 中定义的代理服务。我需要在操作级别应用一项策略,而在消息级别应用其他策略。
我正在使用源视图直接定义代理服务,而不是使用 Web UI/策略编辑器。
我尝试按照此处所述定义每个策略:
http://docs.wso2.org/display/ESB403/Policies+for+Service
但生成的 WSDL 显示它在错误的层次结构中得到应用。
请告知 WSO2 ESB 是否支持此功能,或者我做错了!
我的代理
<proxy name="StockQuoteProxy" transports="https http" startOnLoad="true" trace="disable">
<target endpoint="SimpleStockQuoteService_noSuspendOnFailure_TCPMon">
<inSequence>
<header xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" name="wsse:Security" action="remove"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_3.wsdl"/>
<policy key="sec_operation-Policy"/>
<policy key="sec_InOut-Policy"/>
<enableSec/>
</proxy>
我的消息级别政策
<wsp:PolicyAttachment wsu:Id="Service_message_policy_attachment"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:AppliesTo>
<policy-subject identifier="binding:soap11/operation:getQuote/in"/>
<policy-subject identifier="binding:soap12/operation:getQuote/in"/>
</wsp:AppliesTo>
<wsp:Policy wsu:Id="Service_message_policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:SignedParts>
<sp:Body />
<sp:Header Name="To"
Namespace="http://www.w3.org/2005/08/addressing" />
<sp:Header Name="From"
Namespace="http://www.w3.org/2005/08/addressing" />
<sp:Header Name="FaultTo"
Namespace="http://www.w3.org/2005/08/addressing" />
<sp:Header Name="ReplyTo"
Namespace="http://www.w3.org/2005/08/addressing" />
<sp:Header Name="MessageID"
Namespace="http://www.w3.org/2005/08/addressing" />
<sp:Header Name="RelatesTo"
Namespace="http://www.w3.org/2005/08/addressing" />
<sp:Header Name="Action"
Namespace="http://www.w3.org/2005/08/addressing" />
</sp:SignedParts>
<sp:EncryptedParts>
<sp:Body />
</sp:EncryptedParts>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
</wsp:PolicyAttachment>