Pergunta

I written custom mediator and its working fine I am passing the values to my class mediator using insequence like this

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

The Message property is define inside the class So i wish retrieve it from out side class means insequence Is it possible in wso2esb or not if i get this property out of class then i will get scenario

Foi útil?

Solução

Yes. It is possible. It will work as a normal property which you can refer at any place after you get the return value from class mediator. You can get the property 'Message' as you have mentioned but before that you need to assign the result to the property 'Message'.

See the following sample of assign the result,

        <class name="in.youtility.esb.custommediators.ReadingAlertMediator">
                        <property name="target" value="Message"/>
        </class>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top