user2198133
user2198133

Reputation: 11

how we can store a data or string in txt file in wso2 esb

my issue is i am getting data or json or string from front end or mobile app which contains details of error i need append the all details in single txt file in my local system how can i do this we have any mediator for this or may i use vfs trnsport let me knoe i tried with this code giving error My config is:

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

Error throing from esb side

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

) have any refernace let me know.

Upvotes: 1

Views: 750

Answers (2)

Navaneeth
Navaneeth

Reputation: 51

Sequence Defined inside Log mediator.Define like below

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

Upvotes: 0

Mohanadarshan
Mohanadarshan

Reputation: 830

You need to append the "transport.vfs.Append=true" to out-file URI to append the data in to the existing file... There is a thread regarding this in stackoverflow see the [1]. For more details regarding the VFS please refer the [2].

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

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

Regards,

Mohan

Upvotes: 1

Related Questions