wso2esb 4.8.1和4.9.0不同的onError行为

时间:2015-11-07 20:42:14

标签: wso2esb

我有一个注册的onError序列。

在版本4.8.1中,onfo序列中提供了SOAP信封 而在4.9.0则不是。

为了在错误之后访问4.9.0中的SOAP消息内容(在onError序列中)我总是必须最初将它复制到某个临时变量。这很不方便。

可能是一个错误,还是一个新的"功能" 4.9.0?

这是我的错误序列。如果我删除富集介体信封从序列中出现空的错误。没有rich mediator消息包含空肥皂信封。它可以在log mediator的输出和RabbitMQ后端中存储的消息中看到。实际上,它是XXXXNotifySendSequence序列的onError序列(我将它们都添加到参考中)。

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="XXXXNotifyErrorSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
    <log level="full">
                    <property name="mssg" expression="get-property('mssg')"/>
                    <property name="retry_count" expression="get-property('retry_count')"/>
                </log>
  <filter xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xpath="get-property('mssg')">
    <then>
      <enrich>
        <source clone="true" property="mssg" type="property"/>
        <target type="envelope"/>
      </enrich>
      <property name="mssg" action="remove"/>
    </then>
    <else/>
  </filter>



  <filter xmlns:ns="http://org.apache.synapse/xsd" xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:ns3="http://org.apache.synapse/xsd" xpath="get-property('retry_count')">
        <then>
            <property name="retry_count" expression="number(get-property('retry_count'))+1" scope="default" type="STRING"/>
            <filter xpath="get-property('retry_count') > 5">
                <then>
                    <log>
                        <property name="Dropping--Count" expression="get-property('retry_count')"/>
                    </log>
                    <drop/>
                </then>
                <else>
                    <sequence key="XXXXNotifySendSequence"/>
                </else>
            </filter>
        </then>
        <else>
            <property name="retry_count" value="1" scope="default" type="STRING"/>
            <clone continueParent="true">
                <target>
                    <sequence>
                        <makefault version="soap11">
                            <code xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/" value="soap11Env:VersionMismatch"/>
                            <reason expression="get-property('ERROR_MESSAGE')"/>
                        </makefault>
                        <send/>
                    </sequence>
                </target>
            </clone>
        </else>
    </filter>

    <clone>
        <target>
            <sequence>
                <log level="custom">
                    <property name="STORE" value="store the message"/>
                </log>
                <store messageStore="XXXXRabbitMQNative"/>
            </sequence>
        </target>
    </clone>

</sequence>

这是调用onError sequence

的序列
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="XXXXNotifySendSequence"
  onError="XXXXNotifyErrorSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
  <log level="full">
    <property name="XXXX" value="request start"/>
  </log>
  <enrich>
    <source clone="true" type="envelope"/>
    <target property="mssg" type="property"/>
  </enrich>
  <property name="DISABLE_CHUNKING" scope="axis2" type="STRING" value="true"/>
  <call>
    <endpoint key="HTTPEndpoint"/>
  </call>
  <log level="full">
    <property name="XXXX" value="request end"/>
  </log>
</sequence>

1 个答案:

答案 0 :(得分:0)

我不太清楚你为什么以这种方式编写故障序列。但是当我改变它的工作方式时。无需充实并分配给其他财产

序列:(与你的相同 - 未触及)

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="XXXXNotifySendSequence"
    onError="XXXXNotifyErrorSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
    <log level="full">
        <property name="XXXX" value="request start"/>
    </log>
    <enrich>
        <source clone="true" type="envelope"/>
        <target action="replace" property="mssg" type="property"/>
    </enrich>
    <property name="DISABLE_CHUNKING" scope="axis2" type="STRING" value="true"/>
    <call>
        <endpoint key="HTTPEndpoint"/>
    </call>
    <log level="full">
        <property name="XXXX" value="request end"/>
    </log>
</sequence>

故障序列:

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="XXXXNotifyErrorSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
    <log>
        <property expression="get-property('ERROR_CODE')"
            name="========error-code=========" xmlns:ns="http://org.apache.synapse/xsd"/>
        <property expression="get-property('ERROR_MESSAGE')"
            name="========error-message=========" xmlns:ns="http://org.apache.synapse/xsd"/>
    </log>
    <makefault version="soap11">
        <code value="soap11Env:VersionMismatch" xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/"/>
        <reason expression="get-property('ERROR_MESSAGE')" xmlns:ns="http://org.apache.synapse/xsd"/>
        <role>sample</role>
        <detail>sample detail</detail>
    </makefault>
    <send/>
</sequence>

代理:调用序列

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="samplecall"
       transports="http,https"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target inSequence="XXXXNotifySendSequence"/>
   <description/>
</proxy>

响应:(因为没有定义终点)

 <soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <faultcode xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/">soap11Env:VersionMismatch</faultcode>
   <faultstring>Couldn't find the endpoint with the key : HTTPEndpoint</faultstring>
   <faultactor>sample</faultactor>
   <detail>sample detail</detail>
</soapenv:Fault>

在日志中:

2015-11-08 17:19:55,250]  INFO - LogMediator To: /services/samplecall.samplecallHttpSoap11Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:106d763f-cdc1-43d2-98a9-63d22d17eb81, Direction: request, XXXX = request start, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body/></soapenv:Envelope>
[2015-11-08 17:19:55,252]  INFO - LogMediator To: /services/samplecall.samplecallHttpSoap11Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:106d763f-cdc1-43d2-98a9-63d22d17eb81, Direction: request, ========error-code========= = 305100, ========error-message========= = Couldn't find the endpoint with the key : HTTPEndpoint