2015-11-07 76 views
0

我有一個註冊的onError序列。wso2esb 4.8.1和4.9.0不同的行爲onError

在版本4.8.1中,SOAP信封在onError序列中可用 ,而在4.9.0中不是。

爲了在錯誤發生後(在onError序列中)訪問4.9.0中的SOAP消息內容,我總是必須首先將它複製到某個臨時變量。這是非常不方便的。

它可能是一個錯誤,或者它是4.9.0的新「特徵」嗎?

這是我的錯誤順序。如果我刪除富集中介信封從序列中出現空錯誤。沒有補充中介信息包含空的肥皂信封。可以在日誌中介的輸出中以及存儲在RabbitMQ後端的消息中看到。實際上,它是XXXXNotifySendSequence序列的錯誤序列(我將它們都作爲參考加入)。

<?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序列

<?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> 
+0

你可以分享你的錯序,看看你的不適是什麼意思? –

+0

我已添加onError序列 – Nariman

回答

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 
+0

好的。但SOAP信封的內容在哪裏?它可以在onError序列中訪問嗎? – Nariman

+0

如果出現故障,我將消息存儲在外部隊列中,然後使用採樣消息I處理器從隊列中讀取消息並再次處理它們。這個想法取自 - http://charith.wickramaarachchi.org/2012/05/another-message-redelivery-pattern-with.html。 – Nariman