我在WSO2 ESB中提供了安全代理服务。我跟着这个tutorial。 现在我想通过使用另一个代理服务来调用此服务。但是当我从SoapUI发送请求到简单的代理服务时,我遇到了一个错误。我无法弄清楚的是如何将安全配置传递给代理服务。
注意:我使用的是WSO2 ESB 4.8.1。
安全代理服务代码:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="EchoProxy2"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full" separator="InSequence Log"/>
</inSequence>
<outSequence>
<log level="full" separator="Out Sequence Called"/>
<send/>
</outSequence>
<endpoint>
<address uri="http://wi1-Inspiron-3521:8280/services/echo"/>
</endpoint>
</target>
<parameter name="disableREST">true</parameter>
<parameter name="ScenarioID">scenario2</parameter>
<enableSec/>
<policy key="conf:/repository/axis2/service-groups/EchoProxy2/services/EchoProxy2/policies/SigOnly"/>
<description/>
</proxy>
简单代理服务代码:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="CallEchoProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full" separator="*Calling Proxy In Sequence"/>
</inSequence>
<outSequence>
<log level="full"
separator="Calling Proxy Out Sequence"/>
</outSequence>
<endpoint>
<address uri="http://wi1-Inspiron-3521:8280/services/EchoProxy2"/>
</endpoint>
</target>
<description/>
</proxy>
日志错误:
[2015-02-19 11:22:48,718] ERROR - ServerWorker Error processing POST request for : /services/EchoProxy2
org.apache.axis2.AxisFault: Missing wsse:Security header in request
at org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(RampartReceiver.java:180)
at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:99)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:411)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.rampart.RampartException: Missing wsse:Security header in request
at org.apache.rampart.RampartEngine.process(RampartEngine.java:146)
at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92)
... 10 more
问题: 我无法理解如何将安全配置传递给我的简单代理服务。因此它可以与安全服务通信并获取响应。
答案 0 :(得分:0)
您拥有安全代理,并且您还拥有不安全的代理。当您向非安全代理发送消息时,它必须调用安全代理。因此,您的未安全代理必须调用安全端点。在这里,安全端点是您的安全代理。要调用安全端点,必须将WS-Security策略附加到端点配置。您可以参考this博客,其中介绍了如何调用安全端点。如果您正确地按照步骤操作,我想您可以解决此问题。