ianlee-dev / facebook-java-api

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

application_getPublicInfo returns an empty object #76

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Authenticate in desktop mode and get session
2. call application_getPublicInfo() or application_getPublicInfoByApiKey()
3. call getResponsePOJO() to get the jaxp object

example:

client.application_getPublicInfoByApiKey(apikey);
ApplicationGetPublicInfoResponse appInfo =
(ApplicationGetPublicInfoResponse)fbclient.getResponsePOJO();
out.println(appInfo.getAppInfo().size());

This will output 0, while the list should not be empty.
Wireshark reveals that the response is correct and contains the application
info. Also getResponseRaw() shows that response actually is not empty.

I'm using latest version available (1.8 final).

Original issue reported on code.google.com by angelo.m...@gmail.com on 29 Jul 2008 at 3:55

GoogleCodeExporter commented 8 years ago
I tested svn version (rev 249), and it seems affected by the same issue.

Original comment by angelo.m...@gmail.com on 29 Jul 2008 at 4:36

GoogleCodeExporter commented 8 years ago
The problem here is that the responses Facebook is sending do not conform to 
its 
specified schema.  Specifically, the response is supposed to be of the form:

<xsd:element name="application_getPublicInfo_response">
  <xsd:complexType>
    <xsd:sequence minOccurs="0" maxOccurs="unbounded">
      <xsd:element name="app_info" type="app_info" minOccurs="0" 
maxOccurs="unbounded" />
    </xsd:sequence>
    <xsd:attribute name="list" type="xsd:boolean" />
  </xsd:complexType>
</xsd:element>

...but instead, what Facebook is sending is formatted like this:

<?xml version="1.0" encoding="UTF-8"?>
<application_getPublicInfo_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">  
    <app_id>6479782283</app_id> 
    <api_key>f05d41c89e5bca10d66bc5fb6097b363</api_key> 
    <canvas_name>desktest</canvas_name>  
    <display_name>Desktop Test APP XXXY</display_name> 
    <icon_url>http://static.ak.fbcdn.net/images/icons/hidden.gif?0:27651</icon_url> 
    <logo_url>http://static.ak.fbcdn.net/gpic/missing_app_icon.gif?
0:44717</logo_url>  
    <developers list="true">    
        <developer_info>      
            <uid>110000746</uid>      
            <name>Adam</name>    
        </developer_info>  
    </developers>  
    <company_name/>  
    <description/>  
    <daily_active_users>0</daily_active_users> 
    <daily_active_percentage>0</daily_active_percentage>
</application_getPublicInfo_response>

...the problem is that there is no <app_info> element in there, so JAXB is 
unable to 
parse the response correctly.  There is not much I can do to fix this (short of 
recompiling the JAXB bindings against a "hacked" schema that matches what they 
are 
actually sending).  Really this is a bug on Facebook's part.  You might 
consider 
filing a bug in their issue tracking system, if you'd like.

Original comment by some...@gmail.com on 4 Aug 2008 at 5:15

GoogleCodeExporter commented 8 years ago

Original comment by david.j....@googlemail.com on 19 Nov 2008 at 9:53

GoogleCodeExporter commented 8 years ago
so I just want to let you know how I'm currently handling the facebook.xsd

under the schema project there is a facebook.xsd ( the original ), and a
facebook.xsd.diff (the patch we apply to it ), and it generated
src/main/resources/schema.xsd (the xsd we run off of).

So if you modify the schema.xsd, please regenerate the patch correctly:

diff -ubB facebook.xsd src/main/resources/schema.xsd > facebook.xsd.diff

Original comment by fern...@gmail.com on 19 Nov 2008 at 6:31

GoogleCodeExporter commented 8 years ago
Marking this issue as fixed. The JUnit test called:
Issue118AppGetInfoTest.java
shows that this feature works fine in 2.0.3-SNAPSHOT. When 2.0.3 is out, you'll 
have
no problems calling this function.

Original comment by david.j....@googlemail.com on 2 Dec 2008 at 1:02