How do I upload multiple files over REST over HTTP with Mule?
I have a folder "MyFiles" where I have a lot of files. Now I need to download this file via REST over HTTP. What would be the approach?
I tried the following but it is wrong.
<flow name="testFlow1" doc:name="testFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<http:rest-service-component
serviceUrl="http://localhost:8280/rest/xyz"
httpMethod="POST">
</http:rest-service-component>
<http:endpoint host="localhost" port="5430" encoding="UTF-8"
method="POST" connector-ref="fileHttp" path="fileuploader" name="muleFileUploader">
</http:endpoint>
</flow>
Please, help. Since the input folder will have multiple files, how can we achieve this?
thank
+1
source to share
1 answer
Your stream does not use the input file endpoint and use a generic (non-inbound) HTTP endpoint, so there is no way to work.
Below is a configuration that successfully uploads files to an HTTP endpoint. I can't get it to work without object-to-byte-array-transformer
(the same file being checked over and over again - a bug?), So I hope your files aren't huge ...
<flow name="fileUploader">
<file:inbound-endpoint path="/tmp/mule/in"
pollingFrequency="5000" moveToDirectory="/tmp/mule/done" />
<object-to-byte-array-transformer />
<http:outbound-endpoint address="http://..."
method="POST" exchange-pattern="request-response" />
</flow>
+2
source to share