Questions tagged [play-ws]

12 questions
4
votes
0 answers

Play standalone WS client is unable to upload multipart files without importing the core play framework jar

using the play-ws-standaloneplay-ws-standalone version 2.1.2 I am using the play standalone ws client to make rest calls in my Scala project. In the particular part of my codebase where I have the problem, I do not import the core play framework jar…
gedochao
  • 51
  • 2
2
votes
1 answer

Trying To Understand Which Play Library To Use

What is the difference between the following libraries: libraryDependencies += "com.typesafe.play" %% "play-ahc-ws-standalone" % "LATEST_VERSION" and libraryDependencies += "com.typesafe.play" %% "play-ahc-ws" % "LATEST_VERSION" I am just trying…
Mojo
  • 1,152
  • 1
  • 8
  • 16
2
votes
4 answers

Cannot mock WSRequest.post() using scalamock

I am writing unit tests for Play application using Scalamock and Scalatest. My original code looks like: // Here ws is an injected WSClient val req = Json.toJson(someRequestObject) val resp: Future[WSResponse] =…
Xolve
  • 22,298
  • 21
  • 77
  • 125
1
vote
1 answer

Play WS request times out sooner than withRequestTimeout

I am making a web service request that produces a Future. Like so (a simplified reproduction): import play.api.libs.ws.WSClient import scala.concurrent.{ExecutionContext, Future} import scala.concurrent.duration._ class Service(wsClient:…
Ram
  • 865
  • 1
  • 8
  • 20
1
vote
0 answers

Dependency duplication when creating a fat jar for playframework with play-ws

I noticed that when trying to build fat jara for playframework 2.7 with play-ws (sbt assembly), dependency duplications occur. I get a lot of errors related to javax.activation-api and shaded-asynchttpclient e.g. [error] deduplicate: different file…
I.D.M
  • 57
  • 8
1
vote
0 answers

Play 2.3 WS keystore configuration

I have a p12 keystore having a password e.g. [keystore password] and the private key inside is also encrypted with another password e.g [private key password]. How do I configure it for client authentication in play ws. I tried the below in…
0
votes
1 answer

Converting WSResponse to Result: Recovering lost session key-value from result

I have endpoint which I'll denote as /endpoint which does something like this def endPoint() = Action.async { implicit request => val result: Result = Ok("Done") result.addingToSession("Key" -> "Value"): Result } When I send a WSRequest to the…
0
votes
0 answers

Play Framework: Streaming/Chunking using Play WS

I want to stream large responses from remote servers. For example - I used the following code to stream an image from wikimedia. The expectation was that it will stream the image back to the client in small chunks. However, it loads the entire image…
mohit
  • 4,968
  • 1
  • 22
  • 39
0
votes
1 answer

Send json part in play-ws multipart request

I'm implementing an external API where I need to send a file attachment bundled with a JSON meta part. The following code is not accepted by the server since Play hardcodes the content type of DataPart to text/plain, and the server expects…
Christoffer
  • 25,035
  • 18
  • 53
  • 77
0
votes
1 answer

SSL problem with WS call in play framework

I am locked with a problem to call Freshdesk API from my Play 2.6 application, I created a library to do it using Retrofit and another class to do the same using Play WS but each option fails when I launched the process inside my Play application. I…
fjtorres
  • 266
  • 6
  • 13
0
votes
1 answer

Scala Play WS client making parallel REST calls dynamically

In my scala play framework application, I have to dynamically call multiple REST calls based on urls from a List. I came across following code for multiple calls: val futureResponse = for { responseOne <- WS.url(url1).get() responseTwo <-…
Anurag Sharma
  • 2,409
  • 2
  • 16
  • 34
0
votes
2 answers

Scala - making a WS http request

UPDATED: Method is returning type ANY rather than type Future[string]. Require return of type String. I'm making a http request using the play.ws library 2.6. This was previously done with a curl request but this only uses basic…
crowgers
  • 232
  • 3
  • 19