huuanh1987 / facebook-java-api

Automatically exported from code.google.com/p/facebook-java-api
0 stars 0 forks source link

Not able to get photo albums names of user #127

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

Hi all,

I am facing a problem in retrieving photo album names of a particular user
to our application.

we are using  facebook-java-api-1.8 version

""""
String apiKey =
MobileServerConfiguration.getProperty("Configuration/FacebookDetails/FacebookAPI
Key").trim();
String secret =
MobileServerConfiguration.getProperty("Configuration/FacebookDetails/FacebookSec
ret").trim();
FacebookRestClient client = new FacebookRestClient( apiKey, secret,
mobileServerContext.getUser().getFacebookSession());
String authToken = httpServletRequest.getParameter("auth_token");

Long userId = client.auth_getUserId(authToken);
logger.info(userId);
org.w3c.dom.Document doc =client.photos_getAlbums(userId);
logger.info(doc);

List<String> facebookAlbumList = FacebookSynchronization.getAlbums(doc);
logger.info(facebookAlbumList);  """"

 This is the code we are using 

We are retrieving client object by passing arguments (api key,secret key
and facebook session ) form that client object we are getting the 'userId'
 (Long userId = client.auth_getUserId(authToken);)

then by passing "userId"  as argument we have to get XML object but we are
getting it as null (org.w3c.dom.Document doc
=client.photos_getAlbums(userId);) in this "doc" is XML object but we are
getting it as "NULL"

Original issue reported on code.google.com by kiranman...@gmail.com on 23 Oct 2008 at 5:49

GoogleCodeExporter commented 8 years ago
If you System.out.println(doc) do you get this?:
[#document: null]

If so, please don't confuse this with the variable being null. I've tried 
calling
this method and I get back what I'd expect. However, the default .toString() on 
the
Document Object is pretty rubbish.

<photos_getAlbums_response xmlns="http://api.facebook.com/1.0/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://api.facebook.com/1.0/
http://api.facebook.com/1.0/facebook.xsd"
    list="true">
    <album>
        <aid>
...

Please try to "pretty print" the doc variable. Are you sure you're getting null?

n.b. This feature works with the 2.0.2 version, please upgrade. Please close 
this
issue if you're no longer seeing a problem with the new version.

Original comment by david.j....@googlemail.com on 16 Nov 2008 at 11:58

GoogleCodeExporter commented 8 years ago
Thank you for replying we are trying to upgrade to new version 

Original comment by kiranman...@gmail.com on 17 Nov 2008 at 6:09

GoogleCodeExporter commented 8 years ago
please create a new bug if it still happens with latest version.

Original comment by fern...@gmail.com on 18 Nov 2008 at 3:49

GoogleCodeExporter commented 8 years ago
Ok thankyou

Original comment by kiranman...@gmail.com on 18 Nov 2008 at 5:35