views:

48

answers:

1

I'm trying to get my contacts from Windows Live using RestEasy

After succesfully authenticating my user, I've made the call to https://livecontacts.services.live.com/users/@L@/rest/livecontacts Set the authentication header, added my id and my tokens

If i make the call from command line using cUrl I get the expected output, but in my web application I'm getting back gibberish

e.g.

...?{?[??e^7E?...

Current interface class is

public interface WindowsLiveAPI {

 @GET
 @Path(value="/@L@{liveId}/rest/livecontacts")
 Response getContacts(@PathParam("liveId") @Encoded String liveId, @HeaderParam("Authorization") String delegatedToken);

}

ThrowAway test:

ResteasyProviderFactory.getInstance().addMessageBodyReader(DefaultTextPlain.class);

        RegisterBuiltin.register(ResteasyProviderFactory.getInstance());


        WindowsLiveAPI client = ProxyFactory.create(WindowsLiveAPI.class, "https://livecontacts.services.live.com");
        ClientResponse<LiveContacts> response = (ClientResponse) client.getContacts(LIVE_ID, DELEGATED_TOKEN);
        System.out.println(response.getStatus()); //Produces 200 (401 after token expires)

        System.out.println(response.getEntity(String.class)); //produces gibberish

Does anyone have any clue how to unmarshal the response

A: 

You could try @Produces(MediaType.APPLICATION_XML) [if it's XML] on the method.

Robert Wilson