Objective: Using the file system as transport input medium using inbound file listener.
...
- Start the Axis2 server and deploy the
SimpleStockQuoteService
if not already done - Create three new directories in a test directory, for example, in, out, original in /home/user/test. Open ESB_HOME/repository/samples/synapse_sample_900.xml and edit the following values. Change transport.vfs.FileURI, transport.vfs.MoveAfterProcess, transport.vfs.MoveAfterFailure parameter values to the above in, original, original directories respectively. Change outSequence endpoint address URI to out directory with the prefix vfs:. Values you have to change are marked with
<!--CHANGE-->
. - Start the Synapse configuration numbered 900:
wso2esb-samples.sh -sn 900
- Copy
ESB_HOME/repository/samples/resources/vfs/test.xml
to the directory given intransport.vfs.FileURI
above.
Code Block | ||||
---|---|---|---|---|
| ||||
<definitions xmlns="http://ws.apache.org/ns/synapse"> <proxy name="StockQuoteProxy" transports="vfs <registry provider="org.wso2.carbon.mediation.registry.WSO2Registry"> <parameter name="transport.vfs.FileURI">file:///home/user/test/in</parameter> <!--CHANGE-->cachableDuration">15000</parameter> </registry> <taskManager <parameter nameprovider="transport.vfs.ContentType">text/xml</parameter> org.wso2.carbon.mediation.ntask.NTaskTaskManager"> <parameter name="transport.vfs.FileNamePattern">.*\.xml<cachableDuration">15000</parameter> </taskManager> <parameter name="transport.PollInterval">15</parameter><inboundEndpoint xmlns="http://ws.apache.org/ns/synapse" name="file_inbound" sequence="request" onError="fault" <parameter name="transport.vfs.MoveAfterProcess">file:///home/user/test/original</parameter> <!--CHANGE--> <parameter name="transport.vfs.MoveAfterFailure">file:///home/user/test/original</parameter> <!--CHANGE--> <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter> <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter> <target> <endpoint> <address formatprotocol="soap12file" urisuspend="http://localhost:9000/services/SimpleStockQuoteService"/false"> <parameters> </endpoint> <parameter name="interval">1000</parameter> <outSequence> <parameter name="sequential">true</parameter> <property<parameter name="transport.vfs.ReplyFileName"FileURI">file:///home/user/test/in</parameter> <!--CHANGE--> <parameter name="transport.vfs.ContentType">text/xml</parameter> expression="fn:concat(fn:substring-after(get-property('MessageID'), 'urn:uuid:'), '.xml')" <parameter scopename="transport.vfs.FileNamePattern"/>>.*\.xml</parameter> <parameter name="transport.vfs.MoveAfterProcess">file:///home/user/test/original</parameter> <property action="set" name="OUT_ONLY" value="true"/> <!--CHANGE--> <parameter name="transport.vfs.MoveAfterFailure">file:///home/user/test/original</parameter> <send><!--CHANGE--> <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter> <endpoint> <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter> </parameters> </inboundEndpoint> <address uri="vfs:file:///home/user/test/out"/> <!--CHANGE--> <sequence name="request" onError="fault"> <call> <endpoint> </endpoint> <address format="soap12" uri="http://localhost:9000/services/SimpleStockQuoteService"/> </send> </outSequence> </target>endpoint> </call> <drop/> <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/> </proxy>sequence> </definitions> |
test.xml file
content is as follows:
Code Block | ||
---|---|---|
| ||
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
<soapenv:Body>
<m0:getQuote xmlns:m0="http://services.samples">
<m0:request>
<m0:symbol>IBM</m0:symbol>
</m0:request>
</m0:getQuote>
</soapenv:Body>
</soapenv:Envelope> |
...