1

I use file connector 2 provided by WSO2 ESB (v 5.0.0) to search for a file in the given directory. isFileExist function returns true but when I search for the same file, it returns empty response. Is this a bug or am I missing something?

This is my code

<fileconnector.isFileExist>
 <source>file:///home/test/abc.OUT</source>
</fileconnector.isFileExist>
<log level="full"/>
<fileconnector.search>
 <source>file:///home/test/</source>
 <filePattern>abc.OUT</filePattern>
 <recursiveSearch>false</recursiveSearch>
</fileconnector.search>
<log level="full"/>

This is the response I get

To: , WSAction: mediate, SOAPAction: mediate, MessageID: urn:uuid:2391811e-5c83-4b98-a801-a60fe55b6fd0, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><fileExist>true</fileExist></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
To: , WSAction: mediate, SOAPAction: mediate, MessageID: urn:uuid:2391811e-5c83-4b98-a801-a60fe55b6fd0, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:result xmlns:ns="http://org.wso2.esbconnectors.FileConnector"/></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}

I get the same result when I use .*\.txt file pattern in search too.

Please help, TIA

Community
  • 1
  • 1
Shiv
  • 25
  • 7

1 Answers1

1

Can you try "abc.out" for file pattern in the search operation?

<filePattern>abc.out</filePattern>
  • If you are trying to search all the .txt file, please follow the below sample. file:///home/test/ .*\.txt false – Vivekananthan Sivanayagam Mar 15 '17 at 18:58
  • Now, `.*\.out` works but `.*\.OUT` doesn't. Thanks for the tip. Is there a reason why only smaller case extension works, though my actual file extension is all uppercase? I am testing on Windows right now, hoping this works in Linux as well – Shiv Mar 15 '17 at 19:11
  • If you give .*\.out, it will list all the ".*\.out" and "..*\.out" files. I checked with Ubuntu and it is working. – Vivekananthan Sivanayagam Mar 15 '17 at 19:25