错误处理在WSO2ESB中不起作用

时间:2013-03-08 09:30:48

标签: wso2 wso2esb wso2dss

我的配置是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="tReadingMobile"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence onError="fault">
         <property name="ouid"
                   expression="//WorkOUId//text()"
                   scope="default"
                   type="STRING"/>
         <property name="Time"
                   expression="get-property('SYSTEM_TIME')"
                   scope="default"
                   type="STRING"/>
         <property name="entrymode"
                   expression="//entrymode/text()"
                   scope="default"
                   type="STRING"/>
         <property name="deviceid"
                   expression="//DeviceId/text()"
                   scope="default"
                   type="STRING"/>
         <property name="partybranchid"
                   expression="//PartyBranchId/text()"
                   scope="default"
                   type="STRING"/>
         <property name="userid"
                   expression="//userid/text()"
                   scope="default"
                   type="STRING"/>
         <property name="ReadingDateTime"
                   expression="//ReadingDateTime/text()"
                   scope="default"
                   type="STRING"/>
         <property name="remarks"
                   expression="//Remarks/text()"
                   scope="default"
                   type="STRING"/>
         <property name="taskid"
                   expression="//TaskId/text()"
                   scope="default"
                   type="STRING"/>
         <property name="activityid"
                   expression="//activityid/text()"
                   scope="default"
                   type="STRING"/>
         <property name="assetid"
                   expression="//AssetId/text()"
                   scope="default"
                   type="STRING"/>
         <property name="parametersetid"
                   expression="//ParametersetId/text()"
                   scope="default"
                   type="STRING"/>
         <property name="Reading"
                   expression="//ReadingsLiteTaildto"
                   scope="default"
                   type="STRING"/>
         <enrich>
            <source clone="true" xpath="//ReadingsLiteTaildto"/>
            <target type="property" property="Reading"/>
         </enrich>
         <log level="custom">
            <property name="Reading" expression="get-property('Reading')"/>
         </log>
         <payloadFactory>
            <format>
               <p:insert_taction_operation xmlns:p="http://ws.wso2.org/dataservice">
                  <xs:ouid xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:ouid>
                  <xs:biztransactiontypeid xmlns:xs="http://ws.wso2.org/dataservice">1</xs:biztransactiontypeid>
                  <xs:transactionnumber xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:transactionnumber>
                  <xs:transactiondate xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:transactiondate>
                  <xs:referencenumber xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:referencenumber>
                  <xs:referencedate xmlns:xs="http://ws.wso2.org/dataservice">$3</xs:referencedate>
                  <xs:entrymode xmlns:xs="http://ws.wso2.org/dataservice">$4</xs:entrymode>
                  <xs:deviceid xmlns:xs="http://ws.wso2.org/dataservice">$5</xs:deviceid>
                  <xs:partybranchid xmlns:xs="http://ws.wso2.org/dataservice">$6</xs:partybranchid>
                  <xs:personid xmlns:xs="http://ws.wso2.org/dataservice">$7</xs:personid>
                  <xs:periodfrom xmlns:xs="http://ws.wso2.org/dataservice">$8</xs:periodfrom>
                  <xs:periodto xmlns:xs="http://ws.wso2.org/dataservice">$9</xs:periodto>
                  <xs:remarks xmlns:xs="http://ws.wso2.org/dataservice">$10</xs:remarks>
                  <xs:tags xmlns:xs="http://ws.wso2.org/dataservice">0</xs:tags>
                  <xs:status xmlns:xs="http://ws.wso2.org/dataservice">1</xs:status>
                  <xs:version xmlns:xs="http://ws.wso2.org/dataservice">0</xs:version>
                  <xs:createdbyid xmlns:xs="http://ws.wso2.org/dataservice">$11</xs:createdbyid>
                  <xs:createdon xmlns:xs="http://ws.wso2.org/dataservice">$12</xs:createdon>
                  <xs:modifiedbyid xmlns:xs="http://ws.wso2.org/dataservice">$13</xs:modifiedbyid>
                  <xs:modifiedon xmlns:xs="http://ws.wso2.org/dataservice">$14</xs:modifiedon>
               </p:insert_taction_operation>
            </format>
            <args>
               <arg expression="get-property('ouid')"/>
               <arg expression="get-property('Time')"/>
               <arg expression="get-property('Time')"/>
               <arg expression="get-property('entrymode')"/>
               <arg expression="get-property('deviceid')"/>
               <arg expression="get-property('partybranchid')"/>
               <arg expression="get-property('userid')"/>
               <arg expression="get-property('ReadingDateTime')"/>
               <arg expression="get-property('ReadingDateTime')"/>
               <arg expression="get-property('remarks')"/>
               <arg expression="get-property('userid')"/>
               <arg expression="get-property('ReadingDateTime')"/>
               <arg expression="get-property('userid')"/>
               <arg expression="get-property('ReadingDateTime')"/>
            </args>
         </payloadFactory>
         <send receive="tActionid_Seq">
            <endpoint>
               <address uri="http://localhost:9764/services/taction_DataService/"
                        format="soap11"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence onError="fault">
         <send/>
      </outSequence>
   </target>
</proxy>

我的序列文件是:

<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="tActionid_Seq" onError="fault">
   <property xmlns:ns="http://org.apache.synapse/xsd"
             xmlns:s="http://ws.wso2.org/dataservice"
             name="ActionID"
             expression="//s:actionid/text()"
             scope="default"
             type="STRING"/>
   <filter xmlns:ns="http://org.apache.synapse/xsd"
           xpath="get-property('taskid')='0' or get-property('taskid')='-1'">
      <then>
         <property name="actiontype" value="1"/>
      </then>
      <else>
         <property name="actiontype" value="0"/>
      </else>
   </filter>
   <log level="custom">
      <property xmlns:ns="http://org.apache.synapse/xsd"
                name="kk"
                expression="get-property('ActionID')"/>
   </log>
   <property xmlns:ns="http://org.apache.synapse/xsd"
             name="kk"
             expression="get-property('ActionID')"
             scope="default"
             type="STRING"/>
   <payloadFactory>
      <format>
         <p:insert_tactiondetail_operation xmlns:p="http://ws.wso2.org/dataservice">
            <xs:actionid xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:actionid>
            <xs:slno xmlns:xs="http://ws.wso2.org/dataservice">1</xs:slno>
            <xs:actiontype xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:actiontype>
            <xs:taskid xmlns:xs="http://ws.wso2.org/dataservice">$3</xs:taskid>
            <xs:partybranchid xmlns:xs="http://ws.wso2.org/dataservice">$4</xs:partybranchid>
            <xs:activityid xmlns:xs="http://ws.wso2.org/dataservice">$5</xs:activityid>
            <xs:assetid xmlns:xs="http://ws.wso2.org/dataservice">$6</xs:assetid>
            <xs:parametersetid xmlns:xs="http://ws.wso2.org/dataservice">$7</xs:parametersetid>
            <xs:actionstatus xmlns:xs="http://ws.wso2.org/dataservice">1</xs:actionstatus>
            <xs:reasonid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:reasonid>
            <xs:remarks xmlns:xs="http://ws.wso2.org/dataservice">$8</xs:remarks>
            <xs:periodfrom xmlns:xs="http://ws.wso2.org/dataservice">$9</xs:periodfrom>
            <xs:periodto xmlns:xs="http://ws.wso2.org/dataservice">$10</xs:periodto>
            <xs:duration xmlns:xs="http://ws.wso2.org/dataservice">0</xs:duration>
            <xs:alerts xmlns:xs="http://ws.wso2.org/dataservice">1</xs:alerts>
         </p:insert_tactiondetail_operation>
      </format>
      <args>
         <arg xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('kk')"/>
         <arg xmlns:ns="http://org.apache.synapse/xsd"
              expression="get-property('actiontype')"/>
         <arg xmlns:ns="http://org.apache.synapse/xsd"
              expression="get-property('taskid')"/>
         <arg xmlns:ns="http://org.apache.synapse/xsd"
              expression="get-property('partybranchid')"/>
         <arg xmlns:ns="http://org.apache.synapse/xsd"
              expression="get-property('activityid')"/>
         <arg xmlns:ns="http://org.apache.synapse/xsd"
              expression="get-property('assetid')"/>
         <arg xmlns:ns="http://org.apache.synapse/xsd"
              expression="get-property('parametersetid')"/>
         <arg xmlns:ns="http://org.apache.synapse/xsd"
              expression="get-property('remarks')"/>
         <arg xmlns:ns="http://org.apache.synapse/xsd"
              expression="get-property('ReadingDateTime')"/>
         <arg xmlns:ns="http://org.apache.synapse/xsd"
              expression="get-property('ReadingDateTime')"/>
         <arg xmlns:ns="http://org.apache.synapse/xsd"
              expression="get-property('Message')"/>
      </args>
   </payloadFactory>
   <send receive="tActiondetailid_Seq">
      <endpoint>
         <address uri="http://localhost:9764/services/tactiondetail_DataService/"
                  format="soap11"/>
      </endpoint>
   </send>
</sequence> 

这是我的WSO2DSS。

 <sql>INSERT INTO public.taction(ouid,biztransactiontypeid,transactionnumber,transactiondate,referencenumber,referencedate,entrymode,deviceid,partybranchid,personid,periodfrom,periodto,remarks,tags,status,version,createdbyid,createdon,modifiedbyid,modifiedon) VALUES(?,?,?,(SELECT TIMESTAMP WITH TIME ZONE 'epoch' + ?/1000 * INTERVAL '1 second'),?,(SELECT TIMESTAMP WITH TIME ZONE 'epoch' + ?/1000 * INTERVAL '1 second'),?,?,?,?,(SELECT TIMESTAMP WITH TIME ZONE 'epoch' + ?/1000 * INTERVAL '1 second'),(SELECT TIMESTAMP WITH TIME ZONE 'epoch' + ?/1000 * INTERVAL '1 second'),?,?,?,?,?,(SELECT TIMESTAMP WITH TIME ZONE 'epoch' + ?/1000 * INTERVAL '1 second'),?,(SELECT TIMESTAMP WITH TIME ZONE 'epoch' + ?/1000 * INTERVAL '1 second'))</sql>
      <result element="GeneratedKeys" rowName="Entry" useColumnNumbers="true">
         <element column="1" name="actionid" xsdType="BIGINT"/>
      </result>
      <param name="ouid" ordinal="1" sqlType="INTEGER"/>
      <param name="biztransactiontypeid" ordinal="2" sqlType="INTEGER"/>
      <param name="transactionnumber" ordinal="3" sqlType="STRING"/>
      <param name="transactiondate" ordinal="4" sqlType="BIGINT"/>
      <param name="referencenumber" ordinal="5" sqlType="STRING"/>
      <param name="referencedate" ordinal="6" sqlType="BIGINT"/>
      <param name="entrymode" ordinal="7" sqlType="SMALLINT"/>
      <param name="deviceid" ordinal="8" sqlType="INTEGER"/>
      <param name="partybranchid" ordinal="9" sqlType="INTEGER"/>
      <param name="personid" ordinal="10" sqlType="INTEGER"/>
      <param name="periodfrom" ordinal="11" sqlType="BIGINT"/>
      <param name="periodto" ordinal="12" sqlType="BIGINT"/>
      <param name="remarks" ordinal="13" sqlType="STRING"/>
      <param name="tags" ordinal="14" sqlType="STRING"/>
      <param name="status" ordinal="15" sqlType="SMALLINT"/>
      <param name="version" ordinal="16" sqlType="SMALLINT"/>
      <param name="createdbyid" ordinal="17" sqlType="INTEGER"/>
      <param name="createdon" ordinal="18" sqlType="BIGINT"/>
      <param name="modifiedbyid" ordinal="19" sqlType="INTEGER"/>
      <param name="modifiedon" ordinal="20" sqlType="BIGINT"/>
   </query>
   <query id="update_taction_query" useConfig="default">

虽然我提供了适当的数据,但它正在发挥作用。但是发生了一个没有被处理的错误。我添加了默认的故障序列,但它不起作用。请帮帮我。

1 个答案:

答案 0 :(得分:0)

尝试这样;向代理添加故障序列

 <target faultSequence="fault">