如何逐个处理响应消息?

时间:2012-07-26 13:14:13

标签: clone response wso2

我需要向多个不同的地址发送请求。有些成功,有些可能会返回错误,我需要为此响应写入日志。我想我需要 逐个处理响应消息。如何在后果中做到这一点。 我的服务配置是:

<proxy xmlns="http://ws.apache.org/ns/synapse" name="CloneTest" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <clone id="12345">
            <target>
               <endpoint>
                  <address uri="address1" format="pox" />
               </endpoint>
            </target>
            <target>
               <endpoint>
                  <address uri="address2" format="pox" />
               </endpoint>
            </target>
            <target>
               <endpoint>
                  <address uri="address3" format="pox" />
               </endpoint>
            </target>
         </clone>
      </inSequence>
      <outSequence>
         <log level="full" />
         <send />
      </outSequence>
   </target>
</proxy>

最好的问候。

1 个答案:

答案 0 :(得分:0)

您可以尝试以下方法。首先在ESB中创建三个端点,即“ep1”,“ep2”和“ep3”,对应于您要向其发送克隆请求的三个目标。然后参考代理服务配置中的那些端点,如下所示。

<proxy xmlns="http://ws.apache.org/ns/synapse" name="CloneTest" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <clone id="12345">
            <target endpoint="ep1">
            <target endpoint="ep2">
            <target endpoint="ep3">
         </clone>
      </inSequence>
      <outSequence>
         <log level="full" />
         <send />
      </outSequence>
   </target>
</proxy>