Reactive send file to web service on Play! 2 Scala
I have a file in the Play app! 2, which I want to send to a web service call. I need a reactive way to read a file and send it. I want something like the following:
val source = Source.fromFile("/path/to/someFile")
val holder: WSRequestHolder = WS.url("http://example.com/service")
val futureResult = holder.post(source)
futureResult.onComplete({source.close()})
But the above code doesn't compile.
Is there an idiomatic way to interactively stream a file to a web service?
+3
source to share