title: Using VFS to Write a File
body: <p>I've recently started working with WSO2 and I am encountering a problem with using the VFS to write to a file.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;proxy xmlns="http://ws.apache.org/ns/synapse" name="PX_WriteToFile" transports="https,http,vfs" statistics="disable" trace="disable" startOnLoad="true"&gt;
      &lt;target&gt;
          &lt;inSequence&gt;
              &lt;loopback/&gt;
          &lt;/inSequence&gt;
          &lt;outSequence&gt;
              &lt;payloadFactory media-type="xml"&gt;
                  &lt;format&gt;
                      &lt;Fungus xmlns=""&gt;
                          &lt;Info&gt;$1 is a fungus with a $2 cap. It has $3 stem with $4 gills. It may be dangerous having $5&lt;/Info&gt;
                      &lt;/Fungus&gt;
                  &lt;/format&gt;
                  &lt;args&gt;
                      &lt;arg evaluator="xml" expression="//name"/&gt;
                      &lt;arg evaluator="xml" expression="//cap"/&gt;
                      &lt;arg evaluator="xml" expression="//stem"/&gt;
                      &lt;arg evaluator="xml" expression="//gill"/&gt;
                      &lt;arg evaluator="xml" expression="//toxin"/&gt;
                  &lt;/args&gt;
              &lt;/payloadFactory&gt;
              &lt;property name="transport.vfs.ReplyFileName" value="reply.txt" scope="transport" type="STRING"/&gt;
              &lt;property name="OUT_ONLY" value="true" scope="default" type="BOOLEAN"/&gt;
              &lt;send&gt;
                  &lt;endpoint&gt;
                      &lt;address uri="vfs:file://C:/vfs/reply"/&gt;
                  &lt;/endpoint&gt;
              &lt;/send&gt;
          &lt;/outSequence&gt;
      &lt;/target&gt;
      &lt;parameter name="transport.vfs.ActionAfterProcess"&gt;MOVE&lt;/parameter&gt;
      &lt;parameter name="transport.PollInterval"&gt;5&lt;/parameter&gt;
      &lt;parameter name="transport.vfs.MoveAfterProcess"&gt;file://C:/vfs/map&lt;/parameter&gt;
      &lt;parameter name="transport.vfs.FileURI"&gt;file://C:/vfs/reply&lt;/parameter&gt;
      &lt;parameter name="transport.vfs.MoveAfterFailure"&gt;file://C:/vfs/maf&lt;/parameter&gt;
      &lt;parameter name="transport.vfs.ContentType"&gt;text/xml&lt;/parameter&gt;
      &lt;parameter name="transport.vfs.ActionAfterFailure"&gt;MOVE&lt;/parameter&gt;
      &lt;description/&gt;
  &lt;/proxy&gt;
  </code></pre>
  
  <p>When executing this proxy service I get</p>
  
  <pre><code>[2015-06-03 16:57:24,377]  WARN {SERVICE_LOGGER.PX_WriteToFile} -  Executing fault handler due to exception encountered
  [2015-06-03 16:57:24,378]  WARN {SERVICE_LOGGER.PX_WriteToFile} -  ERROR_CODE : 0 ERROR_MESSAGE : Unexpected error during sending message ou
  t
  [2015-06-03 16:57:24,379]  INFO {SERVICE_LOGGER.PX_WriteToFile} -  FaultHandler executing impl: org.apache.synapse.mediators.MediatorFaultHa
  ndler
  [2015-06-03 16:57:24,380]  WARN {SERVICE_LOGGER.PX_WriteToFile} -  Executing fault sequence mediator : fault
  [2015-06-03 16:57:24,380]  INFO {SERVICE_LOGGER.PX_WriteToFile} -  To: , From: 136.227.134.115, WSAction: urn:mediate, SOAPAction: urn:media
  te, ReplyTo: http://www.w3.org/2005/08/addressing/anonymous, MessageID: http://identifiers.wso2.com/messageid/1433365044366/4616446479, Dire
  ction: response, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Unexpected error during sending message out,
  Envelope: &lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2
  005/08/addressing"&gt;&lt;s:Header&gt;
  
  
  
  &lt;/s:Header&gt;&lt;s:Body&gt;&lt;Fungus&gt;&lt;Info&gt;Silvercap is a fungus with a Blue, White and Pearlescent cap. It has No stem with Smooth gills. It may be d
  angerous having Mercury comparable to Tuna/lb&lt;/Info&gt;&lt;/Fungus&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;
  </code></pre>
  
  <p>VFS is enabled (both Receiver and Sender)
  and I have tried using </p>
  
  <p><a href="https://stackoverflow.com/questions/27856089/writing-on-a-text-file-using-vfs-in-wso2-esb-4-8-1">Writing on a text file using VFS in WSO2 ESB 4.8.1</a></p>
  
  <p>as a reference without luck.</p>
  
  <p>Is there something that I have overlooked?</p>
  
  <p>Thank you,</p>
  
  <pre><code>Additional Logging with Tracing enabled.
  [2015-06-04 08:09:39,784]  INFO {TRACE_LOGGER} -  End : Property mediator
  [2015-06-04 08:09:39,784]  INFO {TRACE_LOGGER} -  Start : Send mediator
  [2015-06-04 08:09:39,785]  INFO {TRACE_LOGGER} -  Sending message through endpoint : null resolving to address = vfs:file:.=///C:/vfs/reply
  [2015-06-04 08:09:39,785]  INFO {TRACE_LOGGER} -  SOAPAction: urn:mediate
  [2015-06-04 08:09:39,785]  INFO {TRACE_LOGGER} -  WSA-Action: urn:mediate
  [2015-06-04 08:09:39,811]  WARN {TRACE_LOGGER} -  Executing fault handler due to exception encountered
  [2015-06-04 08:09:39,811]  WARN {SERVICE_LOGGER.PX_WriteToFile} -  Executing fault handler due to exception encountered
  [2015-06-04 08:09:39,811]  WARN {TRACE_LOGGER} -  ERROR_CODE : 0
  [2015-06-04 08:09:39,811]  WARN {TRACE_LOGGER} -  ERROR_MESSAGE : Unexpected error during sending message out
  [2015-06-04 08:09:39,811]  WARN {TRACE_LOGGER} -  ERROR_DETAIL : org.apache.synapse.SynapseException: Unexpected error during sending message out
      at org.apache.synapse.core.axis2.Axis2Sender.handleException(Axis2Sender.java:172)
      at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:71)
      at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:309)
      at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:333)
      at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)
      at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:97)
      at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
      at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
      at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
      at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:268)
      at org.apache.synapse.mediators.builtin.LoopBackMediator.mediate(LoopBackMediator.java:42)
      at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
      at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
      at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
      at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
      at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
      at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
      at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
      at org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
      at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
      at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
      at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
      at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
      at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49)
      at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
      at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
      at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: org.apache.axis2.AxisFault: The VFS transport doesn't support synchronous responses. Please use the appropriate (out only) message exchange pattern.
      at org.apache.synapse.transport.vfs.VFSTransportSender.sendMessage(VFSTransportSender.java:110)
      at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
      at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
      at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:185)
      at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:167)
      at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
      at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:482)
      at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:59)
      ... 48 more
  
  [2015-06-04 08:09:39,811]  WARN {TRACE_LOGGER} -  ERROR_EXCEPTION : org.apache.synapse.SynapseException: Unexpected error during sending message out
  [2015-06-04 08:09:39,811]  WARN {SERVICE_LOGGER.PX_WriteToFile} -  ERROR_CODE : 0 ERROR_MESSAGE : Unexpected error during sending message out
  </code></pre>