WSO2:在序列A中保存属性并在另一个序列B中使用它(在同一辆车中)

时间:2014-07-04 11:52:31

标签: wso2

我是WSO2的新手。

我有一个序列A,我在其中设置了保存当前消息的属性...

<property name="InitialMessage" expression="$body" scope="default" type="STRING"/>
<log level="full">
    <property name="INITIAL MESSAGE" expression="get-property('InitialMessage')"/>
</log>

这是正常的......

我想在第二个序列B中使用InitialMessage

        <log level="custom">
             <property name="INITIAL MESSAGE" expression="get-property('InitialMessage')"/>
        </log>

但在我的日志中我有以下

TID:[0] [ESB] [2014-07-04 13:36:29,155] INFO {org.apache.synapse.mediators.builtin.LogMediator} - INITIAL MESSAGE = null { org.apache.synapse.mediators.builtin.LogMediator}

注1:这两个序列在​​同一个复合应用程序项目中,并部署在同一个.car

注2:我的进程以名为OperCupInvokeSimonCipeSamplingInputMessageProcessor的消息处理器(采样)开始,该处理器调用OperCupSimonCipeSenderMessage序列(我设置我的属性......)。如果出现故障(这是我现在的用例......),以及我想使用我的属性值的话,这个序列使用OperCupSimonCipeFaultManager序列。

没有代理服务组件:可能是这个问题吗?

不幸的是我无法为结构添加图像(我没有足够的stackoverflow“声誉”:-) ...),所以我希望很清楚

注3 在这里,你是我的第一个序列:

<?xml version="1.0" encoding="UTF-8"?>
   <sequence xmlns="http://ws.apache.org/ns/synapse"
 name="OperCupInvokeSimonCipeSenderManager"
   onError="OperCupInvokeSimonCipeFaultManager">
 <log level="full">
    <property name="where" value="**********
     OPER-CUP-INVOKE-SIMON_CIPE-SENDER-MANAGER - STARTING THE SEQUENCE
     OPER-CUP-INVOKE-SIMON_CIPE-SENDER-MANAGER .... "/>
 </log>
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true" scope="default"
   type="STRING"/>
<log level="full">
    <property name="where" value="**********
       OPER-CUP-INVOKE-SIMON_CIPE-SENDER-MANAGER - SAVE THE CURRENT MESSAGE ...."/>
</log>
<property name="InitialMessage" expression="$body" scope="default"
     type="STRING"/>
<log level="full">
    <property name="INITIAL MESSAGE"
       expression="get-property('InitialMessage')"/>
</log>
<log level="full">
    <property name="where" value="**********
        OPER-CUP-INVOKE-SIMON_CIPE-SENDER-MANAGER - BEFORE TO CALL AN EXTERNAL SERVICE
     ...."/>
</log>
<header name="Action" scope="default" value=""/>
<property name="SOAPAction" value="" scope="transport" type="STRING"/>
<send>
    <endpoint key="OperCupInvokeSimonCipeServiceSimonEndPoint"/>
</send>

这是第二个序列(即第一个序列的故障序列......)

<?xml version="1.0" encoding="UTF-8"?>
  <sequence xmlns="http://ws.apache.org/ns/synapse"
    name="OperCupInvokeSimonCipeFaultManager">
  <log level="full">
    <property name="where" value="**********
      OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - STARTING THE SEQUENCE
      OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER .... "/>
    <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
    <property name="ERROR_MESSAGE"
       expression="get-property('ERROR_MESSAGE')"/>
    <property name="ERROR_DETAIL"
       expression="get-property('ERROR_DETAIL')"/>
    <property name="ERROR_EXCEPTION"
       expression="get-property('ERROR_EXCEPTION')"/>
</log>
<log level="custom">
    <property xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
        xmlns:ns="http://org.apache.synapse/xsd"
        xmlns:ns3="http://org.apache.synapse/xsd" name="retry_count"
        expression="get-property('retry_count')"/>
</log>
<filter xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
       xmlns:ns="http://org.apache.synapse/xsd"
       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="number(get-property('retry_count')) &gt; 3">
            <then>
                <log level="custom">
                    <property name="where" value="**********
                       OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - SERVICE SIMON 
                        DOES NOT RESPOND ....
                    "/>
                    <property name="where" value="**********
                 OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - RETRY_COUNT &gt; 3 .... "/>
                    <property name="DROPPING--COUNT"
                     expression="get-property('retry_count')"/>
                </log>
                <log level="custom">
                    <property name="where" value="**********
            OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - RECOVER INITIAL MESSAGE .... "/>
                    <property name="INITIAL MESSAGE"
                      expression="get-property('InitialMessage')"/>
                </log>
                <store
                  messageStore="OperCupInvokeSimonCipeUnresolvedMessageStore"/>
                <log level="full">
                    <property name="where" value="**********
        OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - THE MESSAGE IS IN UNRESOLVED MESSAGE
            STORE .... "/>
                </log>
            </then>
            <else>
                <log level="custom">
                    <property name="where" value="**********
         OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - SERVICE SIMON DOES NOT RESPOND ....
        "/>
                    <property name="RETRY_COUNT_VALUE"
                      expression="number(get-property('retry_count'))"/>
                    <property name="where" value="**********
       OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - RESTORE AGAIN THE MESSAGE IN WORKING
     MESSAGE STORE .... "/>
                </log>
                <store
                 messageStore="OperCupInvokeSimonCipeWorkingMessageStore"/>
            </else>
        </filter>
    </then>
    <else>
        <log level="custom">
            <property name="where" value="**********
       OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - THE FIRST TIME THAT SERVICE SIMON
       DOES NOT RESPOND .... "/>
            <property name="RETRY_COUNT_INITIAL_VALUE"
 expression="get-property('retry_count')"/>
        </log>
        <property name="retry_count" value="1" scope="default"
    type="STRING"/>
        <log level="custom">
            <property name="where" value="**********
  OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - STORING CURRENT MESSAGE IN WORKING
     MESSAGE STORE FOR THE FIRST TIME .... "/>
            <property name="RETRY_COUNT_INITIAL_VALUE"
       expression="get-property('retry_count')"/>
        </log>
        <log level="custom">
             <property name="where" value="**********
    OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - RECOVER INITIAL MESSAGE .... "/>
        </log>
        <log level="custom">
             <property name="INITIAL MESSAGE"
     expression="get-property('InitialMessage')"/>
        </log>
        <store messageStore="OperCupInvokeSimonCipeWorkingMessageStore"/>
        <log level="full">
            <property name="where" value="**********
      OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - MESSAGE STORED IN WORKING MESSAGE
      STORE FOR THE FIRST TIME .... "/>
        </log>
    </else>
</filter>

这是运行期间的日志..

TID: [0] [ESB] [2014-07-08 11:12:10,098]  INFO      {org.apache.synapse.mediators.builtin.LogMediator} -  To: http://www.w3.org/2005/08  /addressing/anonymous, WSAction: process, SOAPAction: process, MessageID: urn:uuid:A1F6F35D103B414B7A273081153832130-1534945985, Direction: request, where = ********** OPER-CUP-INVOKE-SIMON_CIPE-SENDER-MANAGER - SAVE THE CURRENT MESSAGE ...., Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><gen:generaCupXml xmlns:gen="http://generazionecup.interfacecsi.simonadapterwscup.simon.csi.it" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><in0 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:string">

    &lt;RICHIESTA_GENERAZIONE_CUP&gt;&lt;ID_RICHIESTA&gt;61407&lt;/ID_RICHIESTA&gt;&lt;USER&gt;ws.csipiemcol&lt;/USER&gt;&lt;PASSWORD&gt;sE6454&lt;/PASSWORD&gt;&lt;CUP_GENERAZIONE id_progetto="61407"&gt;&lt;DATI_GENERALI_PROGETTO anno_decisione="2013" cumulativo="N" codifica_locale="61407" natura="02" tipologia="12" settore="11" sottosettore="72" categoria="011"/&gt;&lt;LOCALIZZAZIONE stato="5" regione="01" provincia="001" comune="001219"/&gt;&lt;DESCRIZIONE&gt;&lt;REALIZZ_ACQUISTO_SERVIZI_FORMAZIONE denom_progetto="SERVIZI LAVORO PROV. VC - Op. B3 - Dir.93-2013 - Ob. II.E" denom_ente_corso="ELCAT S.P.A." tipo_ind_area_rifer="01" ind_area_rifer="CSO FRANCIA 98" obiett_corso="PROGETTO NELL'AMBITO DELLA DIRETTIVA Test-C PERCORSI FORMATIVI PER IL LAVORO (RIATTIVO)" mod_intervento_frequenza="ORARIO: non specificato; TOTALE ORE PER PARTECIPANTE: non specificato" strum_progr="99" desc_strum_progr="POR FSE PIEMONTE - 2007IT052PO011"/&gt;&lt;/DESCRIZIONE&gt;&lt;FINANZIAMENTO costo="1.05" finanziamento="1.05"&gt;&lt;CODICE_TIPOLOGIA_COP_FINANZ&gt;001&lt;/CODICE_TIPOLOGIA_COP_FINANZ&gt;&lt;/FINANZIAMENTO&gt;&lt;/CUP_GENERAZIONE&gt;&lt;/RICHIESTA_GENERAZIONE_CUP&gt;

   </in0></gen:generaCupXml></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator} 
  TID: [0] [ESB] [2014-07-08 11:12:10,107]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: process, SOAPAction: process, MessageID: urn:uuid:A1F6F35D103B414B7A273081153832130-1534945985, Direction: request, INITIAL MESSAGE = <soapenv:Body xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><gen:generaCupXml xmlns:gen="http://generazionecup.interfacecsi.simonadapterwscup.simon.csi.it" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><in0 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:string">

    &lt;RICHIESTA_GENERAZIONE_CUP&gt;&lt;ID_RICHIESTA&gt;61407&lt;/ID_RICHIESTA&gt;&lt;USER&gt;ws.csipiemcol&lt;/USER&gt;&lt;PASSWORD&gt;sE6454&lt;/PASSWORD&gt;&lt;CUP_GENERAZIONE id_progetto="61407"&gt;&lt;DATI_GENERALI_PROGETTO anno_decisione="2013" cumulativo="N" codifica_locale="61407" natura="02" tipologia="12" settore="11" sottosettore="72" categoria="011"/&gt;&lt;LOCALIZZAZIONE stato="5" regione="01" provincia="001" comune="001219"/&gt;&lt;DESCRIZIONE&gt;&lt;REALIZZ_ACQUISTO_SERVIZI_FORMAZIONE denom_progetto="SERVIZI LAVORO PROV. VC - Op. B3 - Dir.93-2013 - Ob. II.E" denom_ente_corso="ELCAT S.P.A." tipo_ind_area_rifer="01" ind_area_rifer="CSO FRANCIA 98" obiett_corso="PROGETTO NELL'AMBITO DELLA DIRETTIVA Test-C PERCORSI FORMATIVI PER IL LAVORO (RIATTIVO)" mod_intervento_frequenza="ORARIO: non specificato; TOTALE ORE PER PARTECIPANTE: non specificato" strum_progr="99" desc_strum_progr="POR FSE PIEMONTE - 2007IT052PO011"/&gt;&lt;/DESCRIZIONE&gt;&lt;FINANZIAMENTO costo="1.05" finanziamento="1.05"&gt;&lt;CODICE_TIPOLOGIA_COP_FINANZ&gt;001&lt;/CODICE_TIPOLOGIA_COP_FINANZ&gt;&lt;/FINANZIAMENTO&gt;&lt;/CUP_GENERAZIONE&gt;&lt;/RICHIESTA_GENERAZIONE_CUP&gt;

   </in0></gen:generaCupXml></soapenv:Body>, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><gen:generaCupXml xmlns:gen="http://generazionecup.interfacecsi.simonadapterwscup.simon.csi.it" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><in0 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:string">

    &lt;RICHIESTA_GENERAZIONE_CUP&gt;&lt;ID_RICHIESTA&gt;61407&lt;/ID_RICHIESTA&gt;&lt;USER&gt;ws.csipiemcol&lt;/USER&gt;&lt;PASSWORD&gt;sE6454&lt;/PASSWORD&gt;&lt;CUP_GENERAZIONE id_progetto="61407"&gt;&lt;DATI_GENERALI_PROGETTO anno_decisione="2013" cumulativo="N" codifica_locale="61407" natura="02" tipologia="12" settore="11" sottosettore="72" categoria="011"/&gt;&lt;LOCALIZZAZIONE stato="5" regione="01" provincia="001" comune="001219"/&gt;&lt;DESCRIZIONE&gt;&lt;REALIZZ_ACQUISTO_SERVIZI_FORMAZIONE denom_progetto="SERVIZI LAVORO PROV. VC - Op. B3 - Dir.93-2013 - Ob. II.E" denom_ente_corso="ELCAT S.P.A." tipo_ind_area_rifer="01" ind_area_rifer="CSO FRANCIA 98" obiett_corso="PROGETTO NELL'AMBITO DELLA DIRETTIVA Test-C PERCORSI FORMATIVI PER IL LAVORO (RIATTIVO)" mod_intervento_frequenza="ORARIO: non specificato; TOTALE ORE PER PARTECIPANTE: non specificato" strum_progr="99" desc_strum_progr="POR FSE PIEMONTE - 2007IT052PO011"/&gt;&lt;/DESCRIZIONE&gt;&lt;FINANZIAMENTO costo="1.05" finanziamento="1.05"&gt;&lt;CODICE_TIPOLOGIA_COP_FINANZ&gt;001&lt;/CODICE_TIPOLOGIA_COP_FINANZ&gt;&lt;/FINANZIAMENTO&gt;&lt;/CUP_GENERAZIONE&gt;&lt;/RICHIESTA_GENERAZIONE_CUP&gt;

   </in0></gen:generaCupXml></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
  TID: [0] [ESB] [2014-07-08 11:12:10,112]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: process, SOAPAction: process, MessageID: urn:uuid:A1F6F35D103B414B7A273081153832130-1534945985, Direction: request, where = ********** OPER-CUP-INVOKE-SIMON_CIPE-SENDER-MANAGER - BEFORE TO CALL AN EXTERNAL SERVICE ...., Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><gen:generaCupXml xmlns:gen="http://generazionecup.interfacecsi.simonadapterwscup.simon.csi.it" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><in0 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:string">

    &lt;RICHIESTA_GENERAZIONE_CUP&gt;&lt;ID_RICHIESTA&gt;61407&lt;/ID_RICHIESTA&gt;&lt;USER&gt;ws.csipiemcol&lt;/USER&gt;&lt;PASSWORD&gt;sE6454&lt;/PASSWORD&gt;&lt;CUP_GENERAZIONE id_progetto="61407"&gt;&lt;DATI_GENERALI_PROGETTO anno_decisione="2013" cumulativo="N" codifica_locale="61407" natura="02" tipologia="12" settore="11" sottosettore="72" categoria="011"/&gt;&lt;LOCALIZZAZIONE stato="5" regione="01" provincia="001" comune="001219"/&gt;&lt;DESCRIZIONE&gt;&lt;REALIZZ_ACQUISTO_SERVIZI_FORMAZIONE denom_progetto="SERVIZI LAVORO PROV. VC - Op. B3 - Dir.93-2013 - Ob. II.E" denom_ente_corso="ELCAT S.P.A." tipo_ind_area_rifer="01" ind_area_rifer="CSO FRANCIA 98" obiett_corso="PROGETTO NELL'AMBITO DELLA DIRETTIVA Test-C PERCORSI FORMATIVI PER IL LAVORO (RIATTIVO)" mod_intervento_frequenza="ORARIO: non specificato; TOTALE ORE PER PARTECIPANTE: non specificato" strum_progr="99" desc_strum_progr="POR FSE PIEMONTE - 2007IT052PO011"/&gt;&lt;/DESCRIZIONE&gt;&lt;FINANZIAMENTO costo="1.05" finanziamento="1.05"&gt;&lt;CODICE_TIPOLOGIA_COP_FINANZ&gt;001&lt;/CODICE_TIPOLOGIA_COP_FINANZ&gt;&lt;/FINANZIAMENTO&gt;&lt;/CUP_GENERAZIONE&gt;&lt;/RICHIESTA_GENERAZIONE_CUP&gt;

   </in0></gen:generaCupXml></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-07-08 11:12:10,842]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  To: , WSAction: , SOAPAction: , MessageID: urn:uuid:34abd0a3-45a1-45ef-8026-d738d60e702b, Direction: response, where = ********** OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - STARTING THE SEQUENCE OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER .... , ERROR_CODE = null, ERROR_MESSAGE = null, ERROR_DETAIL = null, ERROR_EXCEPTION = null, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Server.userException</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text xml:lang="en">it.csi.simon.simonadapterwscup.exception.generazionecup.GenerazioneCupException:Errore durante la generazione cup.Porta di Dominio del soggetto SPCMinisteroEconomiaFinanzeCollaudo non disponibile (nested: org.apache.axis.AxisFault, Porta di Dominio del soggetto SPCMinisteroEconomiaFinanzeCollaudo non disponibile)</soapenv:Text></soapenv:Reason><soapenv:Detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">tst-jboss8.csi.it</ns1:hostname></soapenv:Detail></soapenv:Fault></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
   TID: [0] [ESB] [2014-07-08 11:12:10,929]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  retry_count = null {org.apache.synapse.mediators.builtin.LogMediator}
   TID: [0] [ESB] [2014-07-08 11:12:11,074]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  where = ********** OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - THE FIRST TIME THAT SERVICE SIMON DOES NOT RESPOND .... , RETRY_COUNT_INITIAL_VALUE = null {org.apache.synapse.mediators.builtin.LogMediator}
   TID: [0] [ESB] [2014-07-08 11:12:11,075]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  where = ********** OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - STORING CURRENT MESSAGE IN WORKING MESSAGE STORE FOR THE FIRST TIME .... , RETRY_COUNT_INITIAL_VALUE = 1 {org.apache.synapse.mediators.builtin.LogMediator}
   TID: [0] [ESB] [2014-07-08 11:12:11,076]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  where = ********** OPER-CUP-INVOKE-SIMON-CIPE-FAULT-MANAGER - RECOVER INITIAL MESSAGE ....  {org.apache.synapse.mediators.builtin.LogMediator}
   TID: [0] [ESB] [2014-07-08 11:12:11,163]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  INITIAL MESSAGE = null {org.apache.synapse.mediators.builtin.LogMediator}

正如您在开头看到的那样,消息保存在属性端,然后,当我在故障序列中时,我的变量为空

1 个答案:

答案 0 :(得分:1)

如果在sequenceA之后配置sequenceB,这必须有效。基本上在ESB中,一旦将属性设置到消息路径中,它就可以检索消息路径的任何一点(甚至也可以从out序列中检索)。我希望你正在开发代理服务?那么请确保在顺序或顺序中的seqA之后配置seqB。