简体   繁体   中英

Getting error in Aggregate Mediator?

I am using iterate mediater and aggregate mediator. My request is:

<p:GetPersonDataOperation xmlns:p="http://tempuri.org">
  <!--1 or more occurrences-->
  <xs:ID xmlns:xs="http://tempuri.org">1</xs:ID>
 </p:GetPersonDataOperation>

and response is :

<GetPersonDataCollection xmlns="http://tempuri.org">
 <GetPersonData>
  <AppInstanceID>1</AppInstanceID>
  <RecordID>349</RecordID>
  <ID>1</ID>
  <Name>name</Name>
  <LastName>lastname</LastName>
  <Descr>description</Descr>
  <Address>Park Street</Address>
 </GetPersonData>
</GetPersonDataCollection>

If i don't use Aggregate mediator then i get the above response, But if i use Aggregate mediator i get request timeOut Exception

My in Sequence is :

<sequence xmlns="http://ws.apache.org/ns/synapse" name="GetPersonDataOperationSeq">
   <iterate xmlns:xs="http://tempuri.org" xmlns:ns="http://org.apache.synapse/xsd" xmlns:p="http://tempuri.org" preservePayload="true" attachPath="//p:GetPersonData" expression="//p:GetPersonData/xs:ID" id="Iterator1">
      <target>
         <sequence>
            <property name="ID" expression="//xs:ID" scope="default" type="STRING"/>
            <payloadFactory>
               <format>
                  <p:GetPersonData>
                     <xs:ID>$1</xs:ID>
                  </p:GetPersonData>
               </format>
               <args>
                  <arg expression="get-property('ID')"/>
               </args>
            </payloadFactory>
            <send receive="AggregatorSeq">
               <endpoint key="GetPersonDataEP"/>
            </send>
         </sequence>
      </target>
   </iterate>
</sequence>

And From The above in sequence i am redirecting to another Sequence called AggregatorSeq and my AggregatorSeq is:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="AggregatorSeq">
   <log level="custom">
      <property name="CamHereProp" value="*******************Yes??????????????**********************************************"/>
   </log>
   <aggregate>
      <completeCondition>
         <messageCount min="-1" max="-1"/>
      </completeCondition>
      <onComplete xmlns:ns="http://org.apache.synapse/xsd" xmlns:p="http://tempuri.org" expression="//p:GetPersonDataCollection">
         <send/>
      </onComplete>
   </aggregate>
</sequence>

What am i doing wrong.Looking forward to your answers.Thanks in advance

Try adding the ID of the iterator to your aggregator. In your case it should be like,

<aggregate id="Iterator1">

Also, if each of your response body starts with <GetPersonData> then you need to add that to the expression in onComplete.

<onComplete xmlns:ns="http://org.apache.synapse/xsd" xmlns:p="http://tempuri.org" expression="//p:GetPersonData">

Can you specify the issue with the code you have given. You can use <log level="full"/> to debug till what level is your configuration gets executed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM