我们如何在wso2 esb中的txt文件中存储数据或字符串

时间:2013-04-01 10:46:18

标签: wso2 wso2esb wso2dss

我的问题是我从前端或移动应用程序获取数据或json或字符串,其中包含错误的详细信息我需要在本地系统的单个txt文件中附加所有详细信息 我怎么能这样做我们有任何调解员为此或者我可以使用vfs trnsport让我知道我试过这个代码给出错误 我的配置是:

<proxy xmlns="http://ws.apache.org/ns/synapse" name="FileWrite" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
  <target>
     <inSequence>
        <log level="custom">
           <property name="sequence" value="fileWriteSequence"/>
        </log>
        <log>
           <property name="transport.vfs.ReplyFileName" expression="fn:substring-after(get-property('MessageID'), 'urn:uuid:')"/>
           <property name="OUT_ONLY" value="true"/>
        </log>
        <send>
           <endpoint>
              <address uri="///home/youtility2/Desktop/Errorlog"/>
           </endpoint>
        </send>
     </inSequence>
     <outSequence>
        <send/>
     </outSequence>
  </target>
  <parameter name="transport.vfs.ContentType">text/plain</parameter>
  <description></description>
</proxy>

从esb方面误解

2013-04-01 15:58:04,707] ERROR - ClientUtils The system cannot infer the transport information from the ///home/youtility2/Desktop/Errorlog URL.
[2013-04-01 15:58:04,708] ERROR - Axis2Sender Unexpected error during sending message out
org.apache.axis2.AxisFault: The system cannot infer the transport information from the ///home/youtility2/Desktop/Errorlog URL.
       at org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:81

)有任何转介让我知道。

2 个答案:

答案 0 :(得分:1)

您需要将“transport.vfs.Append = true”附加到out-file URI以将数据附加到现有文件中...在stackoverflow中有一个关于此的线程,请参阅[1]。有关VFS的更多详细信息,请参阅[2]。

[1] How to append response message to a text file?

[2] http://docs.wso2.org/wiki/display/ESB403/VFS+Transport

此致

莫汉

答案 1 :(得分:0)

在Log mediator中定义的序列。定义如下

<inSequence>
        <log level="full"/>
           <property name="sequence" value="fileWriteSequence"/>

   <property name="transport.vfs.ReplyFileName" expression="fn:substring-after(get-property('MessageID'), 'urn:uuid:')"/>
           <property name="OUT_ONLY" value="true"/>

        <send>
           <endpoint>
              <address uri="///home/youtility2/Desktop/Errorlog"/>
           </endpoint>
        </send>
     </inSequence>