【问题标题】:how we can store a data or string in txt file in wso2 esb我们如何在 wso2 esb 的 txt 文件中存储数据或字符串
【发布时间】:2017-12-27 16:55:38
【问题描述】:

我的问题是我从前端或移动应用程序获取数据或 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

) 有任何参考请告诉我。

【问题讨论】:

    标签: wso2 wso2esb wso2dss


    【解决方案1】:

    您需要将“transport.vfs.Append=true”附加到输出文件 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

    问候,

    莫汉

    【讨论】:

      【解决方案2】:

      在 Log mediator.Define 中定义的序列如下

      <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>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-08-22
        • 2021-02-09
        • 1970-01-01
        • 1970-01-01
        • 2016-01-17
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多