編譯時出現以下代碼錯誤。 我正在嘗試調用Web服務。Web服務調用Scala Play2錯誤
def authenticate(username: String, password: String): String = {
val request: Future[Response] =
WS.url(XXConstants.URL_GetTicket)
.withTimeout(5000)
.post(Map("username" -> Seq(username), "password" -> Seq(password)))
request map { response =>
Ok(response.xml.text)
} recover {
case t: TimeoutException =>
RequestTimeout(t.getMessage)
case e =>
ServiceUnavailable(e.getMessage)
}
}
我看到以下編譯器錯誤:
type mismatch; found : scala.concurrent.Future[play.api.mvc.SimpleResult[String]] required: String