now I changed the request to:
ClientResponse response = arena.path("user").type(
"application/x-www-form-urlencoded").post(ClientResponse.class,
formData);
and got a NullPointerException :(
I debugged the code and all references are instantiated......
2009/10/7 Felipe Gaścho <fgaucho_at_gmail.com>:
> I am trying to reproduce in code what I can do with curl:
>
> CURL :
>
> curl -d"name=Felipe
> Gaścho&password=test&login=fgaucho&email=fgaucho@gmail.com&url=http://fgaucho.dyndns.org:8080/arena-dwr/confirm"
> http://fgaucho.dyndns.org:8080/arena-http/user
>
> CODE:
>
> public int registerNewUser() {
> Form form = new Form();
> form.add(RegistrationConstants.NAME.value(), "Fake J. Unit");
> form.add(RegistrationConstants.PASSWORD.value(), "fake");
> form.add(RegistrationConstants.LOGIN.value(), "fake");
> form.add(RegistrationConstants.EMAIL.value(), "fake_at_gmail.com");
> form.add(RegistrationConstants.CONFIRMATION_URL.value(),
> "http://fgaucho.dyndns.org:8080/arena-dwr/confirm");
> Response r = arena.path("user").post(Response.class, form);
> return r.getStatus();
> }
>
> The response code in the code is 500 :(
>
>
> The Resource Code:
>
> @POST
> @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
> @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
> public Response insert(@Context UriInfo info,
> @FormParam("login") String login,
> @FormParam("password") String password,
> @FormParam("email") String email, @FormParam("name") String name,
> @FormParam("url") String url, @FormParam("key") String key,
> @FormParam("locale") String locale) {
>
--
Looking for a client application for this service:
http://fgaucho.dyndns.org:8080/arena-http/wadl