聚合调解器wso2无法按预期工作

时间:2012-06-24 23:44:32

标签: wso2 wso2esb

我有一个用例,我需要使用迭代器调解器发送一些调用,并使用聚合调解器来聚合响应。当聚合调解器完成后,其中一个响应是我期望的部分,其他响应被附加到正文的末尾。

我创建了以下代理来演示问题(添加了大量日志信息,以便逻辑易于遵循):

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="GbTestServiceProxy" transports="https http" startOnLoad="true" trace="disable">
    <target endpoint="GbTestServiceEP">
        <inSequence>
            <log level="custom">
                <property name="    **** GbTestServiceProxy ****    " value="    **** inSequence::START ****    " />
            </log>
            <log level="full">
                <property name="    **** GbTestServiceProxy ****    " value="    **** inSequence::messageIn ****    " />
            </log>
            <enrich>
                <source xmlns:gb="http://www.logius.nl/digikoppeling/gb/2010/10" clone="true" xpath="//gb:digikoppeling-external-data-references"/>
                <target type="property" property="DIGI-EXT-DATA-REF"/>
            </enrich>
            <enrich>
                <source type="body" clone="true"/>
                <target type="property" property="ORIG_BODY"/>
            </enrich>
            <log level="custom">
                <property name="    **** GbTestServiceProxy ****    " value="    **** inSequence::DigikoppelingExternalDataReference ****    " />
                <property name="DIGI-EXT-DATA-REF" expression="get-property('DIGI-EXT-DATA-REF')" />
            </log>
            <log level="custom">
                <property name="    **** GbTestServiceProxy ****    " value="    **** inSequence::originalSoapBody ****    " />
                <property name="ORIG_BODY" expression="get-property('ORIG_BODY')" />
            </log>
            <property name="gb_iterate_cnt" value="0"/>
            <property name="gb_aggregate_cnt" value="0"/>
            <iterate xmlns:gb="http://www.logius.nl/digikoppeling/gb/2010/10" preservePayload="true" attachPath="//gb:digikoppeling-external-data-references" expression="//gb:digikoppeling-external-data-references/gb:data-reference">
                <target>
                    <sequence>
                        <xslt key="conf:/xslt/retrieve_gb_data_reference.xslt"/>
                        <property name="gb_iterate_cnt" expression="number(get-property('gb_iterate_cnt')) + 1"/>
                        <log level="full">
                            <property name="    **** GbTestServiceProxy ****    " value="    **** inSequence::iterateDataReference ****    "/>
                            <property name="gb_iterate_cnt" expression="get-property('gb_iterate_cnt')"/>
                        </log>
                        <send>
                            <endpoint>
                                <address uri="http://192.168.56.100:8280/services/GbHandlerStubProxy"/>
                            </endpoint>
                        </send>
                    </sequence>
                </target>
            </iterate>
            <log level="custom">
                <property name="    **** GbTestServiceProxy ****    " value="    **** inSequence::START ****    " />
            </log>
        </inSequence>
        <outSequence>
            <log level="custom">
                <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::START ****    " />
            </log>
            <log level="full">
                <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::messageIn ****    " />
            </log>
            <log level="custom">
                <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::checkIterateCount ****    "/>
                <property name="gb_iterate_cnt" expression="get-property('gb_iterate_cnt')"/>
            </log>
            <property name="gb_aggregate_cnt" expression="number(get-property('gb_aggregate_cnt'))+1"/>
            <log level="custom">
                <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::checkAggregateCount ****    "/>
                <property name="gb_aggregate_cnt" expression="get-property('gb_aggregate_cnt')"/>
            </log>
            <aggregate>
                <completeCondition timeout="5000">
                    <messageCount min="3" max="3"/>
                </completeCondition>
                <onComplete xmlns:poc="http://minienm.nl/wso2/wus/2.0/testgb/1.0/" expression="//poc:data-reference-local">
                    <log level="custom">
                        <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::checkAggregateCount ****    "/>
                        <property name="gb_aggregate_cnt" expression="get-property('gb_aggregate_cnt')"/>
                    </log>
                    <log level="full">
                        <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::resultAggregate ****    " />
                    </log>
                    <log level="custom">
                        <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::enrich#1-storeAggregateResult ****    "/>
                    </log>
                    <enrich>
                        <source type="body" clone="false"/>
                        <target type="property" property="RESULT_AGGREGATE"/>
                    </enrich>
                    <log level="custom">
                        <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::originalResultAggregate ****    " />
                        <property name="RESULT_AGGREGATE" expression="get-property('RESULT_AGGREGATE')" />
                    </log>
                    <log level="custom">
                        <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::enrich#2-replaceAggregateResultWithOriginalBody ****    "/>
                    </log>
                    <enrich>
                        <source type="property" clone="false" property="ORIG_BODY"/>
                        <target type="body"/>
                    </enrich>
                    <log level="custom">
                        <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::enrich#3-addHolderForAggregateResultToBody ****    "/>
                    </log>
                    <enrich>
                        <source type="inline" clone="false">
                            <poc:internal-data-references xmlns:poc="http://minienm.nl/wso2/wus/2.0/testgb/1.0/"/>
                        </source>
                        <target xmlns:gb="http://www.logius.nl/digikoppeling/gb/2010/10" action="sibling" xpath="//gb:digikoppeling-external-data-references"/>
                    </enrich>
                    <log level="custom">
                        <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::enrich#4-addAggregateResultToHolder ****    "/>
                    </log>
                    <enrich>
                        <source type="property" clone="false" property="RESULT_AGGREGATE"/>
                        <target xmlns:poc="http://minienm.nl/wso2/wus/2.0/testgb/1.0/" action="child" xpath="//poc:internal-data-references"/>
                    </enrich>
                    <log level="full">
                        <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::send ****    "/>
                    </log>
                    <send />
                </onComplete>
            </aggregate>
            <log level="custom">
                <property name="    **** GbTestServiceProxy ****    " value="    **** outSequence::END ****    " />
            </log>
        </outSequence>
    </target>
    <publishWSDL uri="http://192.168.56.100:8280/services/TestGb_WUS_2.0_v1.0?wsdl"/>
</proxy>

<proxy xmlns="http://ws.apache.org/ns/synapse" name="GbHandlerStubProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
    <target>
        <inSequence>
            <log level="custom">
                <property name="    **** GbHandlerStubProxy ****    " value="    START    " />
            </log>
            <xslt key="conf:/xslt/create_response_stub_gb_handler.xslt">
                <property name="localDirectory" value="/this/is/a/local/directory/" />
            </xslt>
            <header name="To" action="remove" />
            <property name="RESPONSE" value="true" scope="default" type="STRING" />
            <log level="custom">
                <property name="    **** GbHandlerStubProxy ****    " value="    END    " />
            </log>
            <send />
        </inSequence>
    </target>
</proxy>

这是一条测试信息:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://minienm.nl/wso2/wus/2.0/testgb/1.0/" xmlns:ns1="http://www.logius.nl/digikoppeling/gb/2010/10">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:aanleverBericht>
         <!--Optional:-->
         <ns:kenmerk>kenmerk</ns:kenmerk>
         <ns:berichtsoort>berichtsoort</ns:berichtsoort>
         <!--Optional:-->
         <ns:aanleverkenmerk>aanleverkenmerk</ns:aanleverkenmerk>
         <!--Optional:-->
         <ns:eerderAanleverkenmerk>eerderAanleverkenmerk</ns:eerderAanleverkenmerk>
         <ns:identiteitBelanghebbende>
            <ns:nummer>nummer</ns:nummer>
            <!--Optional:-->
            <ns:type>KvK</ns:type>
         </ns:identiteitBelanghebbende>
         <ns:rolBelanghebbende>rolBelanghebbende</ns:rolBelanghebbende>
         <!--Optional:-->
         <ns:identiteitOntvanger>
            <ns:nummer>nummer</ns:nummer>
            <!--Optional:-->
            <ns:type>OIN</ns:type>
         </ns:identiteitOntvanger>
         <!--Optional:-->
         <ns:rolOntvanger>rolOntvanger</ns:rolOntvanger>
         <ns:berichtInhoud>
            <ns:mimeType>mimeType</ns:mimeType>
            <ns:bestandsnaam>bestandsnaam</ns:bestandsnaam>
            <ns:inhoud>VGhpcyBpcyBhIHRlc3QgYmFzZTY0IGVuY29kZWQgc3RyaW5n</ns:inhoud>
         </ns:berichtInhoud>
         <!--Optional:-->
         <ns:berichtBijlagen>
            <!--1 or more repetitions:-->
            <ns:bijlage>
               <ns:mimeType>mimeType</ns:mimeType>
               <ns:bestandsnaam>bestandsnaam</ns:bestandsnaam>
               <ns:inhoud>VGhpcyBpcyBhIHRlc3QgYmFzZTY0IGVuY29kZWQgc3RyaW5n</ns:inhoud>
            </ns:bijlage>
         </ns:berichtBijlagen>
         <!--Optional:-->
         <ns:autorisatieAdres>autorisatieAdres</ns:autorisatieAdres>
         <!--Optional:-->
         <ns1:digikoppeling-external-data-references profile="digikoppeling-gb-1.0">
            <!--1 or more repetitions:-->
            <ns1:data-reference contextId="contextId-1">
               <ns1:lifetime>
                  <!--Optional:-->
                  <ns1:creationTime type="xs:dateTime">2001-12-31T12:00:00Z</ns1:creationTime>
                  <!--Optional:-->
                  <ns1:expirationTime type="xs:dateTime">2001-12-31T12:00:00Z</ns1:expirationTime>
               </ns1:lifetime>
               <ns1:content contentType="contentType">
                  <ns1:filename>filename</ns1:filename>
                  <ns1:checksum type="MD5">0123456789abcdef0123456789abcdef</ns1:checksum>
                  <ns1:size>1000</ns1:size>
               </ns1:content>
               <ns1:transport>
                  <ns1:location>
                     <!--You have a CHOICE of the next 2 items at this level-->
                     <ns1:senderUrl type="xs:anyURI">>https://any.url/any.name.sender</ns1:senderUrl>
                  </ns1:location>
               </ns1:transport>
            </ns1:data-reference>
            <ns1:data-reference contextId="contextId-2">
               <ns1:lifetime>
                  <!--Optional:-->
                  <ns1:creationTime type="xs:dateTime">2001-12-31T12:00:00Z</ns1:creationTime>
                  <!--Optional:-->
                  <ns1:expirationTime type="xs:dateTime">2001-12-31T12:00:00Z</ns1:expirationTime>
               </ns1:lifetime>
               <ns1:content contentType="contentType">
                  <ns1:filename>filename</ns1:filename>
                  <ns1:checksum type="MD5">0123456789abcdef0123456789abcdef</ns1:checksum>
                  <ns1:size>1000</ns1:size>
               </ns1:content>
               <ns1:transport>
                  <ns1:location>
                     <!--You have a CHOICE of the next 2 items at this level-->
                     <ns1:senderUrl type="xs:anyURI">>https://any.url/any.name.sender</ns1:senderUrl>
                  </ns1:location>
               </ns1:transport>
            </ns1:data-reference>
            <ns1:data-reference contextId="contextId-3">
               <ns1:lifetime>
                  <!--Optional:-->
                  <ns1:creationTime type="xs:dateTime">2001-12-31T12:00:00Z</ns1:creationTime>
                  <!--Optional:-->
                  <ns1:expirationTime type="xs:dateTime">2001-12-31T12:00:00Z</ns1:expirationTime>
               </ns1:lifetime>
               <ns1:content contentType="contentType">
                  <ns1:filename>filename</ns1:filename>
                  <ns1:checksum type="MD5">0123456789abcdef0123456789abcdef</ns1:checksum>
                  <ns1:size>1000</ns1:size>
               </ns1:content>
               <ns1:transport>
                  <ns1:location>
                     <!--You have a CHOICE of the next 2 items at this level-->
                     <ns1:senderUrl type="xs:anyURI">>https://any.url/any.name.sender</ns1:senderUrl>
                  </ns1:location>
               </ns1:transport>
            </ns1:data-reference>
         </ns1:digikoppeling-external-data-references>
      </ns:aanleverBericht>
   </soapenv:Body>
</soapenv:Envelope>

结果如下:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <wsa:MessageID>urn:uuid:63df7b91-b96b-4894-9f02-dd00145e4493</wsa:MessageID>
      <wsa:Action>//www.minienm.nl/TestGb_WUS_2.0_v1.0/TestGb_WUS_2.0_v1.0/submitDocumentResponse</wsa:Action>
      <wsa:RelatesTo>urn:uuid:4ab77dc5-96ac-41d7-8e74-0b444a6cf7e5</wsa:RelatesTo>
   </soapenv:Header>
   <soapenv:Body>
      <ns:aanleverBericht xmlns:ns="http://minienm.nl/wso2/wus/2.0/testgb/1.0/">
         <!--Optional:-->
         <ns:kenmerk>kenmerk</ns:kenmerk>
         <ns:berichtsoort>berichtsoort</ns:berichtsoort>
         <!--Optional:-->
         <ns:aanleverkenmerk>aanleverkenmerk</ns:aanleverkenmerk>
         <!--Optional:-->
         <ns:eerderAanleverkenmerk>eerderAanleverkenmerk</ns:eerderAanleverkenmerk>
         <ns:identiteitBelanghebbende>
            <ns:nummer>nummer</ns:nummer>
            <!--Optional:-->
            <ns:type>KvK</ns:type>
         </ns:identiteitBelanghebbende>
         <ns:rolBelanghebbende>rolBelanghebbende</ns:rolBelanghebbende>
         <!--Optional:-->
         <ns:identiteitOntvanger>
            <ns:nummer>nummer</ns:nummer>
            <!--Optional:-->
            <ns:type>OIN</ns:type>
         </ns:identiteitOntvanger>
         <!--Optional:-->
         <ns:rolOntvanger>rolOntvanger</ns:rolOntvanger>
         <ns:berichtInhoud>
            <ns:mimeType>mimeType</ns:mimeType>
            <ns:bestandsnaam>bestandsnaam</ns:bestandsnaam>
            <ns:inhoud>VGhpcyBpcyBhIHRlc3QgYmFzZTY0IGVuY29kZWQgc3RyaW5n</ns:inhoud>
         </ns:berichtInhoud>
         <!--Optional:-->
         <ns:berichtBijlagen>
            <!--1 or more repetitions:-->
            <ns:bijlage>
               <ns:mimeType>mimeType</ns:mimeType>
               <ns:bestandsnaam>bestandsnaam</ns:bestandsnaam>
               <ns:inhoud>VGhpcyBpcyBhIHRlc3QgYmFzZTY0IGVuY29kZWQgc3RyaW5n</ns:inhoud>
            </ns:bijlage>
         </ns:berichtBijlagen>
         <!--Optional:-->
         <ns:autorisatieAdres>autorisatieAdres</ns:autorisatieAdres>
         <!--Optional:-->
         <ns1:digikoppeling-external-data-references profile="digikoppeling-gb-1.0" xmlns:ns1="http://www.logius.nl/digikoppeling/gb/2010/10">
            <!--1 or more repetitions:-->
            <ns1:data-reference contextId="contextId-1">
               <ns1:lifetime>
                  <!--Optional:-->
                  <ns1:creationTime type="xs:dateTime">2001-12-31T12:00:00Z</ns1:creationTime>
                  <!--Optional:-->
                  <ns1:expirationTime type="xs:dateTime">2001-12-31T12:00:00Z</ns1:expirationTime>
               </ns1:lifetime>
               <ns1:content contentType="contentType">
                  <ns1:filename>filename</ns1:filename>
                  <ns1:checksum type="MD5">0123456789abcdef0123456789abcdef</ns1:checksum>
                  <ns1:size>1000</ns1:size>
               </ns1:content>
               <ns1:transport>
                  <ns1:location>
                     <!--You have a CHOICE of the next 2 items at this level-->
                     <ns1:senderUrl type="xs:anyURI">>https://any.url/any.name.sender</ns1:senderUrl>
                  </ns1:location>
               </ns1:transport>
            </ns1:data-reference>
            <ns1:data-reference contextId="contextId-2">
               <ns1:lifetime>
                  <!--Optional:-->
                  <ns1:creationTime type="xs:dateTime">2001-12-31T12:00:00Z</ns1:creationTime>
                  <!--Optional:-->
                  <ns1:expirationTime type="xs:dateTime">2001-12-31T12:00:00Z</ns1:expirationTime>
               </ns1:lifetime>
               <ns1:content contentType="contentType">
                  <ns1:filename>filename</ns1:filename>
                  <ns1:checksum type="MD5">0123456789abcdef0123456789abcdef</ns1:checksum>
                  <ns1:size>1000</ns1:size>
               </ns1:content>
               <ns1:transport>
                  <ns1:location>
                     <!--You have a CHOICE of the next 2 items at this level-->
                     <ns1:senderUrl type="xs:anyURI">>https://any.url/any.name.sender</ns1:senderUrl>
                  </ns1:location>
               </ns1:transport>
            </ns1:data-reference>
            <ns1:data-reference contextId="contextId-3">
               <ns1:lifetime>
                  <!--Optional:-->
                  <ns1:creationTime type="xs:dateTime">2001-12-31T12:00:00Z</ns1:creationTime>
                  <!--Optional:-->
                  <ns1:expirationTime type="xs:dateTime">2001-12-31T12:00:00Z</ns1:expirationTime>
               </ns1:lifetime>
               <ns1:content contentType="contentType">
                  <ns1:filename>filename</ns1:filename>
                  <ns1:checksum type="MD5">0123456789abcdef0123456789abcdef</ns1:checksum>
                  <ns1:size>1000</ns1:size>
               </ns1:content>
               <ns1:transport>
                  <ns1:location>
                     <!--You have a CHOICE of the next 2 items at this level-->
                     <ns1:senderUrl type="xs:anyURI">>https://any.url/any.name.sender</ns1:senderUrl>
                  </ns1:location>
               </ns1:transport>
            </ns1:data-reference>
         </ns1:digikoppeling-external-data-references>
         <poc:internal-data-references xmlns:poc="http://minienm.nl/wso2/wus/2.0/testgb/1.0/">
            <poc:data-reference-local contextId="contextId-1" xmlns:gb="http://www.logius.nl/digikoppeling/gb/2010/10">
               <poc:location>/this/is/a/local/directory/filename</poc:location>
            </poc:data-reference-local>
         </poc:internal-data-references>
      </ns:aanleverBericht>
      <poc:data-reference-local contextId="contextId-2" xmlns:poc="http://minienm.nl/wso2/wus/2.0/testgb/1.0/" xmlns:gb="http://www.logius.nl/digikoppeling/gb/2010/10">
         <poc:location>/this/is/a/local/directory/filename</poc:location>
      </poc:data-reference-local>
      <poc:data-reference-local contextId="contextId-3" xmlns:poc="http://minienm.nl/wso2/wus/2.0/testgb/1.0/" xmlns:gb="http://www.logius.nl/digikoppeling/gb/2010/10">
         <poc:location>/this/is/a/local/directory/filename</poc:location>
      </poc:data-reference-local>
   </soapenv:Body>
</soapenv:Envelope>

正如您所看到的,最后两个poc:data-reference-local条目被附加到正文的末尾。我有什么想法吗?

我看到的另一个奇怪的事情是聚合mmediator的第二个日志条目(outSequence :: resultAggregate),按预期显示所有三个结果。但是,日志条目originalResultAggregate仅显示第一个。这与我遇到的奇怪行为有关吗?

编辑:我注意到的另一件事是我添加的计数器功能不起作用(参见属性gb_iterate_cnt&amp; gb_aggregate_cnt)。我究竟做错了什么?

问候,nidkil

0 个答案:

没有答案