我们可以在代理序列中获得Class return属性

时间:2013-07-23 07:44:46

标签: wso2 wso2esb wso2dss

我编写了自定义调解器并且工作正常我正在使用像这样的序列将值传递给我的类调解器

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="tReadingMobile_5"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence onError="fault">
         <property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
         <property name="Reading"
                   expression="//Readings"
                   scope="default"
                   type="STRING"/>
         <property name="actiondetailid"
                   expression="//actiondetailid/text()"
                   scope="default"
                   type="STRING"/>
         <property name="actionid"
                   expression="//actionid/text()"
                   scope="default"
                   type="STRING"/>
         <property name="userid"
                   expression="//userid/text()"
                   scope="default"
                   type="STRING"/>
         <property name="assetid"
                   expression="//assetid/text()"
                   scope="default"
                   type="STRING"/>
         <property name="partybranchid"
                   expression="//partybranchid/text()"
                   scope="default"
                   type="STRING"/>
         <property name="activityid"
                   expression="//activityid/text()"
                   scope="default"
                   type="STRING"/>
         <property name="clientid"
                   expression="//clientid/text()"
                   scope="default"
                   type="STRING"/>
         <property name="ouid"
                   expression="//ouid/text()"
                   scope="default"
                   type="STRING"/>
         <log level="custom">
            <property name="fff" expression="get-property('Reading')"/>
            <property name="ggggg" expression="get-property('actiondetailid')"/>
            <property name="hhhh" expression="get-property('actionid')"/>
            <property name="partybranchid" expression="get-property('partybranchid')"/>
         </log>
         <iterate continueParent="true"
                  id="Readings"
                  expression="//ReadingsLiteTaildto">
            <target>
               <sequence>
                  <property name="actiondetailid" expression="get-property('actiondetailid')"/>
                  <property name="parameterid" expression="//ParameterId/text()"/>
                  <property name="slno" expression="//SlNo/text()"/>
                  <property name="inputvalue" expression="//InputValue/text()"/>
                  <property name="inputtext" expression="//InputText/text()"/>
                  <property name="finalvalue" expression="//FinalValue/text()"/>
                  <payloadFactory>
                     <format>
                        <p:insert_treadings_operation xmlns:p="http://ws.wso2.org/dataservice">
                           <xs:actiondetailid xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:actiondetailid>
                           <xs:slno xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:slno>
                           <xs:parameterid xmlns:xs="http://ws.wso2.org/dataservice">$3</xs:parameterid>
                           <xs:inputvalue xmlns:xs="http://ws.wso2.org/dataservice">$4</xs:inputvalue>
                           <xs:inputtext xmlns:xs="http://ws.wso2.org/dataservice">$5</xs:inputtext>
                           <xs:finalvalue xmlns:xs="http://ws.wso2.org/dataservice">$6</xs:finalvalue>
                        </p:insert_treadings_operation>
                     </format>
                     <args>
                        <arg expression="get-property('actiondetailid')"/>
                        <arg expression="get-property('slno')"/>
                        <arg expression="get-property('parameterid')"/>
                        <arg expression="get-property('inputvalue')"/>
                        <arg expression="get-property('inputtext')"/>
                        <arg expression="get-property('finalvalue')"/>
                     </args>
                  </payloadFactory>
                  <send receive="tReadingsid_Seq">
                     <endpoint>
                        <address uri="http://localhost:9764/services/treadings_DataService/"
                                 format="soap11"/>
                     </endpoint>
                  </send>
               </sequence>
            </target>
         </iterate>
        <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<property xmlns:ns="http://org.apache.synapse/xsd"
             name="Time"
             expression="get-property('SYSTEM_TIME')"
             scope="default"
             type="STRING"/>
         <property name="actiondetailid"
                   expression="get-property('actiondetailid')"
                   scope="default"
                   type="STRING"/>
         <property name="OUT_ONLY" value="true"/>
         <property name="dbconnectionurl"
                   value="jdbc:postgresql://$$$$$$$$$$/*****"/>
         <property name="dbuser" value="##########"/>
         <property name="dbpassword" value="*******"/>
         <class name="in.youtility.esb.custommediators.ReadingAlertMediator"/>
<property name="Message"
                   expression="get-property('Message')"
                   scope="default"
                   type="STRING"/>
      </inSequence>
      <outSequence onError="fault"/>
   </target>
</proxy>

Message属性在类中定义 所以我希望从外面的类中检索它意味着顺序 是否有可能在wso2esb中,如果我从课堂上获得这个属性,那么我将得到方案

1 个答案:

答案 0 :(得分:0)

是。有可能的。它将作为普通属性工作,您可以在从类调解器获得返回值后在任何地方引用它。 您可以如上所述获取“消息”属性,但在此之前,您需要将结果分配给属性“消息”。

请参阅以下分配结果的示例

        <class name="in.youtility.esb.custommediators.ReadingAlertMediator">
                        <property name="target" value="Message"/>
        </class>