VFS Transport Error inside Iterator mediator in wso2 - wso2

I am converting a csv file, where each csv record is getting converted to json. I am using an iterator mediator to send each json object to an endpoint by modifying it using payload-factory mediator. But I get this VFS error at the end. How can I fix this?
ERROR {VFSTransportSender} - Error while attaching VFS file system properties. null
[2022-07-20 19:30:46,925] ERROR {VFSTransportSender} - Unable to determine out transport information to send message
[2022-07-20 19:30:46,929] ERROR {Axis2Sender} - {proxy:TestProxy} Access-Control-Allow-Credentials:true,Access-Control-Allow-Headers:Authorization, Content-Type, fluent.account,Access-Control-Allow-Methods:POST, PUT, GET, OPTIONS, DELETE,Access-Control-Allow-Origin:*,Access-Control-Expose-Headers:flex.type, flex.version,Access-Control-Max-Age:3600,Cache-Control:no-cache, no-store, max-age=0, must-revalidate,Connection:keep-alive,Content-Type:application/json;charset=UTF-8,Date:Wed, 20 Jul 2022 14:00:47 GMT,Expires:0,Pragma:no-cache,Server:nginx/1.10.3 (Ubuntu),Transfer-Encoding:chunked,X-Content-Type-Options:nosniff,X-Frame-Options:DENY,X-XSS-Protection:1; mode=block, Unexpected error sending message back org.apache.axis2.AxisFault: Unable to determine out transport information to send message
at org.apache.axis2.transport.base.AbstractTransportSender.handleException(AbstractTransportSender.java:234)
at org.apache.synapse.transport.vfs.VFSTransportSender.writeFile(VFSTransportSender.java:331)
at org.apache.synapse.transport.vfs.VFSTransportSender.sendMessage(VFSTransportSender.java:189)
at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:119)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:213)
at org.apache.synapse.mediators.builtin.RespondMediator.mediate(RespondMediator.java:46)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:263)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:820)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:322)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:608)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:207)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:298)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Synapse Configs
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="TestProxy" startOnLoad="true" transports="http https vfs" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<smooks config-key="smooks_conf">
<input type="text"/>
<output type="xml"/>
</smooks>
<log level="full"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<log>
<property expression="json-eval($)" name="Response"/>
</log>
<call-template target="Template"/>
<log>
<property name="Info" value="Before Iteration"/>
</log>
<iterate continueParent="true" expression="$body//ProductData/Product" id="Iterate-over-products" xmlns:ns="http://org.apache.synapse/xsd">
<target>
<sequence>
<log>
<property name="Info" value="Inside Iteration"/>
</log>
<payloadFactory media-type="json">
<format>
{
"ref": "$1",
"name": "$2",
"summary": "This is a HP",
"attributes": [
{
"name": "imageUrl",
"type": "STRING",
"value": "$3"
},
]
}
}
</format>
<args>
<arg evaluator="json" expression="$.Product.ProductCode" />
<arg evaluator="json" expression="$.Product.ProductName" />
<arg evaluator="json" expression="$.Product.ProductUrl"/>
</args>
</payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<call>
<endpoint>
<http method="post" uri-template""=>
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
<log>
<property expression="json-eval($)" name="product"/>
</log>
</sequence>
</target>
</iterate>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="transport.vfs.Streaming">true</parameter>
<parameter name="transport.PollInterval">1</parameter>
<parameter name="transport.vfs.FileURI">file://C://in</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file://C:/out</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.csv</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file://C:/history</parameter>
</proxy>
All the logs just before the iterate mediator get printed. The flow stops from the iterate mediator and produce the VFS transport error

Since you are using a custom connector within the template I'm assuming your connector is not properly written which overrides the current message context. Hence after the connector, there is no content to Iterate over. In order to get around this issue save the message to a property after the Smooks mediator and then restore the message before the Iterate mediator. For this, You can use the Enrich Mediator.
To Save the payload
<enrich>
<source type="body"/>
<target type="property" property="jsonPayload"/>
</enrich>
To restore the payload
<enrich description="Restore original payload">
<source clone="false" property="jsonPayload" type="property"/>
<target type="body"/>
</enrich>
Additional notes: When you are using Iterate Mediator It should be always accompanied by an Aggregate mediator. You can read more about this here.

Related

VFS Transport Sender Warning

I am using a proxy that reads from a csv file, converts into a desired json payloads and writes to two different sftp locations sequentially via a clone. When i execute this operation i get the following warning in the logs for every file that's written.Do i need to change any configurations in the sequence or properties?
Warning log :
WARN {VFSTransportSender} - Could not set last modified. org.apache.commons.vfs2.FileSystemException: Could not set the last modified timestamp of "sftp://sftp4u.pivotree:***#sftp4u.blob.core.windows.net/Francescas/dev/VariantFeedToBloomreach/out/Put/2023-02-14T10-45-02.json".
at org.apache.commons.vfs2.provider.DefaultFileContent.setLastModifiedTime(DefaultFileContent.java:180)
at org.apache.synapse.transport.vfs.VFSTransportSender.populateResponseFile(VFSTransportSender.java:366)
at org.apache.synapse.transport.vfs.VFSTransportSender.writeFile(VFSTransportSender.java:280)
at org.apache.synapse.transport.vfs.VFSTransportSender.sendMessage(VFSTransportSender.java:189)
at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:678)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:86)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:586)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:409)
at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:77)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:123)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:214)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.mediators.eip.Target.mediateMessage(Target.java:256)
at org.apache.synapse.mediators.eip.Target.mediate(Target.java:111)
at org.apache.synapse.mediators.eip.splitter.CloneMediator.mediate(CloneMediator.java:136)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:228)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.axis2.transport.base.AbstractTransportListener.handleIncomingMessage(AbstractTransportListener.java:328)
at org.apache.synapse.transport.vfs.VFSTransportListener.processFile(VFSTransportListener.java:854)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:480)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:189)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:135)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: 8: UnsupportedOperation: This operation is currently unsupported.
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873)
at com.jcraft.jsch.ChannelSftp._setStat(ChannelSftp.java:2418)
at com.jcraft.jsch.ChannelSftp.setStat(ChannelSftp.java:2392)
at org.apache.commons.vfs2.provider.sftp.SftpFileObject.flushStat(SftpFileObject.java:201)
at org.apache.commons.vfs2.provider.sftp.SftpFileObject.doSetLastModifiedTime(SftpFileObject.java:194)
at org.apache.commons.vfs2.provider.DefaultFileContent.setLastModifiedTime(DefaultFileContent.java:176)
... 38 more
Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="SampleProxy" startOnLoad="true" transports="http https vfs" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<smooks config-key="SmooksConf">
<input type="text"/>
<output type="xml"/>
</smooks>
<property expression="$body/*" name="Data" scope="default" type="OM"/>
<clone sequential="true">
<target>
<sequence>
<xslt key="sampleXSLT1"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<property name="JSON1" expression="json-eval($)"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<property expression="fn:concat('abc','.json')" name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="ClientApiNonBlocking" value="true" scope="axis2" action="remove"/>
<send>
<endpoint>
<address uri="vfs:sftp://{sftp_path}/folder?sftpPathFromRoot=true&transport.vfs.AvoidPermissionCheck=true;transport.vfs.Streaming=true;">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</address>
</endpoint>
</send>
</sequence>
</target>
<target>
<sequence>
<xslt key="sampleXSLT2"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<property name="JSON2" expression="json-eval($)"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<property expression="fn:concat('xyz','.json')" name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="ClientApiNonBlocking" value="true" scope="axis2" action="remove"/>
<send>
<endpoint>
<address uri="vfs:sftp://{sftp_path}/folder?sftpPathFromRoot=true&transport.vfs.AvoidPermissionCheck=true;transport.vfs.Streaming=true;">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</address>
</endpoint>
</send>
</sequence>
</target>
</clone>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="transport.vfs.Streaming">true</parameter>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.MaxRetryCount">1</parameter>
<parameter name="transport.vfs.FileURI">sftp://{sftp_path}/input?sftpPathFromRoot=true&transport.vfs.AvoidPermissionCheck=true</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterFailure">sftp://{sftp_path}/error?sftpPathFromRoot=true&transport.vfs.AvoidPermissionCheck=true</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.csv</parameter>
<parameter name="transport.vfs.MoveAfterProcess">sftp://{sftp_path}/move?sftpPathFromRoot=true&transport.vfs.AvoidPermissionCheck=true</parameter>
</proxy>
Please try adding this property in the proxy, this works in wso2 ei 6.6.
<property action="remove" name="LAST_MODIFIED" scope="transport"/>
A new VFS property[1] was introduced to ignore setting the last modified timestamp of MI and EI.
In the VFS proxy, you can set the following parameter,
<parameter name="transport.vfs.UpdateLastModified">false</parameter>
This feature is available in MI 4.1.0 base pack. If you are using EI 6.6.0 or MI 1.2.0 you will need to update those products using a WSO2 subscription.
For more information on WSO2 subscription check https://wso2.com/subscription/
[1] - https://github.com/wso2/micro-integrator/issues/2318

Different behaviors between ESB 4.9.0 and 4.8.1

I have this proxy service in ESB 4.8.1, when I test it with SoapUI 5.2.1. I got this problem:
Does not write the full log in the server console when a timeout rise, but when I change it to custom it works.
Does not return any response to SoapUI (payloadFactory does not work)
When I deploy it in ESB 4.9.0 it works perfectly. Its a bug from the older version? How can I fix it?
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="StockQuoteProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<send>
<endpoint>
<address uri="http://localhost:8089/mockStockQuoteProxySoap11Binding"
format="soap11">
<timeout>
<duration>1000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>101500,101501,101506,101507,101508</errorCodes>
<initialDuration>2000</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>3000</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<errorCodes>101504,101505</errorCodes>
<retriesBeforeSuspension>3</retriesBeforeSuspension>
<retryDelay>1</retryDelay>
</markForSuspension>
</address>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence>
<log level="full">
<property name="FALLO" value="DETALLES DEL ERROR!!"/>
<property name="message" expression="get-property('ERROR_MESSAGE')"/>
<property name="code" expression="get-property('ERROR_CODE')"/>
<property name="detail" expression="get-property('ERROR_DETAIL')"/>
<property name="exception" expression="get-property('ERROR_EXCEPTION')"/>
</log>
<payloadFactory>
<format>
<ns:MyResponse xmlns:ns="http://services.samples">
<ns:Error>Execution Error</ns:Error>
</ns:MyResponse>
</format>
</payloadFactory>
<header name="To" action="remove"/>
<property name="RESPONSE" value="true"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<send/>
</faultSequence>
</target>
<description/>
</proxy>
Thanks in advance.
Try with this fault sequence:
Steps:
Create my response message.
Use the enrich mediator to store the body in property OK.
Create a fault message.
Override the body with the property OK using the enrich mediator.
<payloadFactory>
<format>
<ns:getQuoteResponse xmlns:ns="http://services.samples">
<ns:return xmlns:ax21="http://services.samples/xsd">
<status>ERROR</status>
</ns:return>
</ns:getQuoteResponse>
</format>
</payloadFactory>
<log level="full">
<property name="MESSAGE" value="Mensaje despues del payloadFactory"></property>
</log>
<enrich>
<source clone="true" type="body"></source>
<target action="replace" type="property" property="OK"></target>
</enrich>
<makefault version="soap11">
<code xmlns:soap11Env="schemas.xmlsoap.org/soap/envelope/" value="soap11Env:EdnpointTimeout"/>
<reason value="timeout fault"/>
<role/>
</makefault>
<enrich>
<source type="property" clone="true" property="OK"/>
<target type="body"/>
</enrich>
<log level="full">
<property name="MESSAGE" value="Mensaje despues del enrich"></property>
</log>
<send/>
When I run this proxy this is what I get as the response and the console log. Were you expecting something like this?
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<ns:MyResponse xmlns:ns="http://services.samples">
<ns:Error>Execution Error</ns:Error>
</ns:MyResponse>
</soap:Body>
</soap:Envelope>
INFO - LogMediator To: /services/StockQuoteProxy.StockQuoteProxyHttpSoap12Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:44da8426-00fc-442a-b4e9-1a9a1dd948f2, Direction: request, FALLO = DETALLES DEL ERROR!!, message = Error connecting to the back end, code = 101503, detail = Error connecting to the back end, exception = null, Envelope: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body></soap:Body></soap:Envelope>

How to invoke DSS service from ESB - I feel that I'm close, I just need a nudge

I think i'm getting close with this. I'm trying to invoke an insert call on a DSS service from and ESB in WSO2.
I have the DSS service setup and I am able to insert data into the table from the 'try it' link. I copied the WSDL to the ESB and referenced the endpoint. I can see the insert operation from the ESB try it service. I put in my data and click send. I see a 'success' response come back but nothing is being added to the table.
Is anyone willing to nudge me in the right direction with this?
Thank you!
Response from try it service
<success details="in-only operation"/>
proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="MyProxy"
transports="https,http,local,vfs"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="targetfilename" value="TITLES"/>
<log level="full"/>
<clone/>
</inSequence>
</target>
<publishWSDL key="InsertServiceWSDL"/>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.FileURI">file:///var/process
/rrin</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///var/process
/rroriginal</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///var/process
/rrfault</parameter>
<parameter name="transport.vfs.FileNamePattern">TITLES.xml</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<description/>
</proxy>
You'll need to add an address endpoint pointing to the DSS service. Refer to this sample which is on how to define a proxy service for an axis2 web service. Your scenario is very similar to this.
Here is how I did it. The call will now hit the DSS and insert the data into the table. I am seeing some errors in the log for each XML row it processes and send to the DSS. I'm not sure why yet. I'm still researching that.
Edit: I changed the call mediator to a send mediator and that fixed this issue. I am no longer getting this error message.
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Premature end of file.
Here is my sequence.
<sequence xmlns="http://ws.apache.org/ns/synapse" name="MySequence">
<log level="custom">
<property name="sequence" value="MySequence"></property>
</log>
<property xmlns:ns="http://org.apache.synapse/xsd" name="filename" expression="get-property('transport', 'FILE_NAME')"></property>
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="show-name" expression="get-property('filename')"></property>
<property xmlns:ns="http://org.apache.synapse/xsd" name="file-name" expression="get-property('targetfilename')"></property>
</log>
<iterate xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" xmlns:z="RowsetSchema" expression="//z:row" id="It1">
<target>
<sequence>
<property name="Id" expression="//z:row/#ID"></property>
<property name="vch" expression="//z:row/#vch"></property>
<log level="custom">
<property name="showids" expression="get-property('Id')"></property>
<property name="showvch" expression="get-property('vch')"></property>
</log>
<filter xpath="//z:row[starts-with(#vch, '978')]">
<then>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:p="http://ws.wso2.org/dataservice">
<soapenv:Body>
<p:insert_AR_operation>
<p:ID xmlns:xs="http://ws.wso2.org/dataservice">$1</p:ID>
<p:vch xmlns:xs="http://ws.wso2.org/dataservice">$2</p:vch>
</p:insert_AR_operation>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg expression="get-property('Id')" evaluator="xml"></arg>
<arg expression="get-property('vch')" evaluator="xml"></arg>
</args>
</payloadFactory>
<log level="custom">
<property name="sequence" value="Calling LevelsAR_ISBNService"></property>
</log>
<property name="HTTP_METHOD" value="POST" scope="axis2"></property>
<property name="SOAPAction" value="insert_AR_operation" scope="transport"></property>
<send>
<endpoint>
<address uri="http://*.*.*.*:****/services/AR_Service.HTTPEndpoint/"></address>
</endpoint>
</send>
</then>
<else>
<log level="custom">
<property name="sequence" value="Condition Drop"></property>
</log>
<drop></drop>
</else>
</filter>
</sequence>
</target>
</iterate>
<property xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" name="transport.vfs.ReplyFileName" expression="fn:concat(get-property('SYSTEM_DATE', 'yyMMddHHmmss'), '-', get-property('filename'))" scope="transport"></property>
<property name="OUT_ONLY" value="true"></property>
</sequence>

Writing on a text file using VFS in WSO2 ESB 4.8.1

I am using VFS transport to poll a simple text file and then i send the text of a file to a queue. This flow works fine but in case of error scenario when fault sequence is executed , i want to write my error message to a simple text file and it is not Working.
Note:
I am using WSO2 ESB Version 4.8.1.
I have enabled the VFS transport in my "axis2.xml" file.
I have also tried all the solutions provided in this question which is related to mine.
My Service Code:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="FileWriteTest"
transports="vfs"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full"
separator="******************FileWrite In Sequence Start*************"/>
</inSequence>
<outSequence/>
<faultSequence>
<payloadFactory media-type="xml">
<format>
<MessageFormat xmlns="">
<ECode>$1</ECode>
<EMsg>$2</EMsg>
<EDetail>$3</EDetail>
<EException>$4</EException>
</MessageFormat>
</format>
<args>
<arg evaluator="xml" expression="get-property('ERROR_CODE')"/>
<arg evaluator="xml" expression="get-property('ERROR_MESSAGE')"/>
<arg evaluator="xml" expression="get-property('ERROR_DETAIL')"/>
<arg evaluator="xml" expression="get-property('ERROR_EXCEPTION')"/>
</args>
</payloadFactory>
<property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
<property name="ClientApiNonBlocking" scope="axis2" action="remove"/>
<send>
<endpoint>
<address uri="vfs:file:///home/omerkhalid/Documents/WSO2Test/FileWrite/Errorlog.txt"/>
</endpoint>
</send>
</faultSequence>
<endpoint>
<address uri="jms:/FileWriterResponse?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:6616&transport.jms.DestinationType=queue"/>
</endpoint>
</target>
<parameter name="transport.PollInterval">10</parameter>
<parameter name="transport.vfs.FileURI">file://home/omerkhalid/Documents/WSO2Test/FileWrite/InTest</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file://home/omerkhalid/Documents/WSO2Test/FileWrite/DoneTest</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.txt</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="serviceType">proxy</parameter>
<description/>
</proxy>
Problem Area:
The problem is in the following area of code, where i am defining my endpoint for Fault Sequence. It does create an file on that particular location but that file remains empty.
<send>
<endpoint>
<address uri="vfs:file:///home/omerkhalid/Documents/WSO2Test/FileWrite/Errorlog.txt"/>
</endpoint>
</send>
Exception:
org.apache.axis2.AxisFault: The system cannot infer the transport information from the file:///home/omerkhalid/Documents/WSO2Test/FileWrite/Errorlog.txt URL.
at org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:81)
at org.apache.axis2.client.OperationClient.prepareMessageContext(OperationClient.java:288)
at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:249)
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)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:338)
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.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:85)
at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:54)
at org.apache.synapse.endpoints.AbstractEndpoint.invokeNextFaultHandler(AbstractEndpoint.java:640)
at org.apache.synapse.endpoints.AbstractEndpoint.onFault(AbstractEndpoint.java:475)
at org.apache.synapse.endpoints.AddressEndpoint.onFault(AddressEndpoint.java:43)
at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:102)
at org.apache.synapse.core.axis2.AsyncCallback.onError(AsyncCallback.java:67)
at org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:643)
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:744)
Change your message in payloadFactory from your faultSequence :
The root node of your message must be : <text xmlns="http://ws.apache.org/commons/ns/payload">
and the content of this node will be the text value sent to your file

How do I return a response in an wso2 esb proxy with vfs JMS Sender?

I have a proxy service in WSO2 ESB 4.5.0 that is supposed to handle a SOAP-request from a webclient, send information to a JMS-topic and then respond to the the webclient.
The problem is that when I use the JMS-sender it by default waits for a response on a temporary queue.
To change the behavior of the JMS-Sender I can set OUT_ONLY to true, but then the webclient does not get a response at all.
Is there a way to return a response even if I set OUT_ONLY to true?
OR
Can I set JMS-Sender not to expect a reply without sending OUT_ONLY to true?
According to your requirement you may need to use a Messagestore, please refer the following configuration, which stores the message in JMSStore and sending the acknowledgement back to the client (success or failed),followed by ESB uses the forward schedul processor which guarantees that the store message in the JMSStore will be delivered to the backend, and in the case of the real BE (may be JMS) failed it retires thus util the message is delivered thus it wont be removed from the Message store, this a part how the DEAD LATTER CHANNELING has been accomplished using WSO2 ESB
<proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy" transports="http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="target.endpoint" value="JMSEP"/>
<property name="enableREST" value="true"/>
<store messageStore="JMSMS"/>
<payloadFactory>
<format>
<esbResponse xmlns="">
<text> added sccuessfully </text>
</esbResponse>
</format>
</payloadFactory>
<header name="To" action="remove"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<send/>
</inSequence>
<faultSequence>
<makefault version="soap11">
<code xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/" value="soap11Env:VersionMismatch"/>
<reason value="test"/>
<role>MessageStoreFault</role>
<detail>MessageStoreFault</detail>
</makefault>
<send/>
</faultSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
<description></description>
</proxy>
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="JMSEP">
<address uri="jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616" format="pox">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
<timeout>
<duration>1000</duration>
<responseAction>fault</responseAction>
</timeout>
</address>
</endpoint>
<messageStore name="JMSMS" class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="store.jms.destination">JMSMS</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
<parameter name="store.jms.cache.connection">false</parameter>
</messageStore>
<messageProcessor name="Processor1" class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor" messageStore="JMSMS" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="interval">4000</parameter>
</messageProcessor>