Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class callingWS {
- def callWSMethod(name: String, filename: String) = {
- val data = Json.obj(
- "input_sent" -> name,
- "Filename" -> filename)
- val holder: Future[Response] = WS.url("http://0.0.0.0:8015/endpoint/").withHeaders("Content-Type" -> "application/json").post(data)
- implicit val context = scala.concurrent.ExecutionContext.Implicits.global
- implicit val timeout = Timeout(100000 milliseconds)
- val future = holder.map { response =>
- (response.json \ "result")
- }
- val result = Await.result(future, timeout.duration)
- result
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement