Search code examples
esbsmookswso2-esb

WSO2 Smook response not write to file


I'm trying write the response from a proxy with Smooks Mediator on a file but nothing happens.

The mediator get a csv file with vfs option, convert to xml output and send the csv to a out directory correctely. In console i see the ws02-esb-service.log and the xml is correctly. But i not do get write to file. In /u01/app/wso2esb-4.7.0/tmp/send/convert then result not appears. And not have any error. This is the code.

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="SmookTest"
       transports="vfs"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <smooks config-key="smooks-registro">
            <input type="text"/>
            <output type="xml"/>
         </smooks>
         <log level="full"/>
         <property name="transport.vfs.ReplyFileName"
                   value="test1.xml"
                   scope="transport"/>
         <property name="OUT_ONLY" value="true"/>
         <send>
            <endpoint name="grabar">
               <address uri="vfs:file:///u01/app/wso2esb-4.7.0/tmp/send/convert"/>
            </endpoint>
         </send>
      </inSequence>
   </target>
   <parameter name="transport.vfs.ReplyFileURI">salida.xml</parameter>
   <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
   <parameter name="transport.PollInterval">5</parameter>
   <parameter name="transport.vfs.FileURI">/u01/app/wso2esb-4.7.0/tmp/send</parameter>
   <parameter name="transport.vfs.MoveAfterProcess">/u01/app/wso2esb-4.7.0/tmp/send/out</parameter>
   <parameter name="transport.vfs.MoveAfterFailure">/u01/app/wso2esb-4.7.0/tmp/send/fail</parameter>
   <parameter name="transport.vfs.FileNamePattern">.*.csv</parameter>
   <parameter name="transport.vfs.ContentType">text/plain</parameter>
   <description/>
</proxy>

Solution

  • Since the VFS read as a plain/text format it will not engage the formarter until you explicitly mention it. Therefore you can mention the content type before you call the endpoint

    Like

     <property name="OUT_ONLY" value="true"/>
     <property name="messageType"
               value="application/soap"
               scope="axis2"
               type="STRING"/>
    
     <send>
        <endpoint name="grabar">
           <address uri="vfs:file:///u01/app/wso2esb-4.7.0/tmp/send/convert"/>
        </endpoint>
     </send>