2016-09-27 53 views
1

我正在尝试使用gzip压缩我正在写入系统磁盘的xml文件。这可以通过使用WSO2 ESB来实现吗?我目前的配置是这样的:如何使用WSO2 ESB从xml文件制作gzip?

<api xmlns="http://ws.apache.org/ns/synapse" name="test" context="/test"> 
    <resource methods="GET" uri-template="/test*"> 
     <inSequence> 
     <call> 
      <endpoint template="TestEndpoint"/> 
     </call> 
     <property name="transport.vfs.ReplyFileName" 
        value="test.xml')" 
        scope="transport"/> 
     <property name="OUT_ONLY" value="true"/> 
     <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/> 
     <property name="Content-Encoding" value="gzip" scope="transport"/> 
     <call> 
      <endpoint> 
       <address uri="vfs:file:///home/esb/test"/> 
      </endpoint> 
     </call> 
     <property name="OUT_ONLY" value="true"/> 
     <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/> 
     <send/> 
     </inSequence> 
    </resource> 
</api>                      
+0

配置似乎没问题。你有错误吗? –

+0

不,这个配置只生成xml文件,我希望它被归档为gzip。 – zygimantus

+0

所以你需要创建一个gz归档文件,里面有test.xml文件。 –

回答

1

AFAIK有没有开箱即用的方法来做到这一点。但作为一项工作,你可以做到以下几点:

  1. 写一个自定义的类调解器来压缩一些内容(归档保存的xml文件在这种情况下)。
  2. 使用现有序列使用VFS传输将文件保存到文件系统。
  3. 在序列调用VFS端点后调用类中介。

您可以使用this guide编写类中介。

希望这会有所帮助。