WSO2 ESB:如何使用计划任务将 SOAP 答案携带到文件(或数据库)中

WSO2 ESB: how to carry a SOAP answer into a file (or DB) using a scheduled task

我在 WSO2 ESB 中部署了一个代理服务,它通过 SOAP 请求向 Web 服务请求数据集,并且 Web 服务正确地 returns 请求的数据集。为了获得 Web 服务正确答案的证据,我该如何在任务的定期调度期间将此数据集存储到通用文件中?

在您的代理定义中,您可以找到:

  • 将请求发送到此代理时执行的顺序,
  • 一个 outSequence,如果您从 inSequence 发送请求(使用发送中介),它会收到响应
  • 如果发生错误则执行 faultSequence。

因此,如果您使用发送调解器从您的 inSequence "asks a web service for a dataset",您的 outSequence 会收到响应(您的 "dataset"),您只需将其发送到文件即可:

<!-- name of the file -->
<property name="transport.vfs.ReplyFileName" value="dataset.xml" scope="transport"/>
<!-- OUT_ONLY because we want to use send mediator but don't want a callback waiting for a response -->
<property name="OUT_ONLY" value="true" />
<!-- Send current message (the response from your webService) to the filesystem : test directory must exist on c:\ -->
<send>
  <endpoint>
     <address uri="vfs:file:///C:/test"/>
  </endpoint>
</send>

--> 不要忘记在 repository/conf/axis2/axis2.xml 中激活 VFS 发送器:取消注释 <transportSender name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportSender"/>