다음 코드를 사용하여 컴파일 할 때 오류가 발생합니다. 웹 서비스를 호출하려고합니다.웹 서비스 호출에서 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)
}
}
나는 다음과 같은 컴파일러 오류보고 있어요 : 값이 authenticate
함수에서 반환되는
type mismatch; found : scala.concurrent.Future[play.api.mvc.SimpleResult[String]] required: String