I\'m trying to perform a post with play.api.libs.ws.WS but I can\'t figure out how to set the params, my code:
Promise promise = WS.url(Play.
Hmm I guess I should really start looking at the imports!
I accidentally used import play.api.libs.ws.WS instead of import play.libs.WS; When using play.libs.WS all the methods such as post(String string) and setContentType(String string) revealed themselves. This is how I did it:
import play.Play;
import play.libs.F;
import play.libs.WS;
public static Result wsAction() {
return async(
play.libs.WS.url(Play.application().configuration()
.getString("sms.service.url"))
.setContentType("application/x-www-form-urlencoded; charset=utf-8")
.post("param1=foo¶m2=bar").map(
new F.Function() {
public Result apply(WS.Response response) {
return ok(response.toString());
}
}
)
);
}