我在WSO2 ESB 4.6.0中遇到以下代理问题:
<proxy name="GetCapacity" transports="http https" startOnLoad="true" trace="disable">
<target>
<inSequence>
<xslt key="conf:ManageWorkforce/xslt/GetCapacity_Request.xsl"/>
<send>
<endpoint key="Capacity"/>
</send>
</inSequence>
<outSequence>
<filter xpath="get-property('FAULT')">
<then>
<log level="full" separator=",">
<property name="trace" value="-------- FAULT ---------"/>
</log>
<xslt key="conf:ManageWorkforce/xslt/SoapFaultToStandardHeader.xsl"/>
<header name="To" expression="get-property('ReplyTo')"/>
</then>
<else>
<xslt key="conf:ManageWorkforce/xslt/GetCapacity_Response.xsl"/>
</else>
</filter>
<send/>
</outSequence>
<faultSequence>
<log level="full" separator=",">
<property name="trace" value="-------- FAULT SEQUENCE -------"/>
</log>
<property name="RESPONSE" value="true"/>
<header name="To" expression="get-property('ReplyTo')"/>
</faultSequence>
</target>
</proxy>
当我用soapUI调用它并且Service抛出SoapFault(FAULT属性为TRUE)时,WSO2中出现以下错误:
[2014-01-20 19:13:30,764] ERROR - Axis2Sender Unexpected error sending message back
org.apache.axis2.AxisFault: no protocol:
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:453)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:277)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:161)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:282)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:92)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:230)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:443)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:238)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:167)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:456)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:316)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:329)
at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)
at org.apache.synapse.endpoints.IndirectEndpoint.send(IndirectEndpoint.java:54)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:95)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:154)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:434)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:219)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.net.MalformedURLException: no protocol:
at java.net.URL.<init>(URL.java:567)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:422)
... 31 more
我做错了什么?
答案 0 :(得分:1)
根据错误,似乎“To”标题不正确。您可以尝试删除“收件人”标题并查看。在您的配置中,“To”标题已使用“ReplyTo”属性添加。因此,请在您的故障序列中添加以下内容
<header name="To" action="remove"/>
此外,最好启用调试日志,以解决问题。这将显示电汇中的消息。请在log4j.properties文件中启用以下两个属性,该文件位于/ repository / conf目录中。
log4j.logger.org.apache.synapse.transport.nhttp.wire = DEBUG log4j.logger.org.apache.synapse.transport.nhttp.headers = DEBUG
在答案中添加更多内容,您已从“ReplyTo”复制“To”标题。您可以将“ReplyTo”的值记录如下,以检查它是否确实不正确。
<log level="custom"><property name="RelyTo" expression="get-property('ReplyTo')"/></log>