huuanh1987 / facebook-java-api

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

feed_registerTemplateBundle() method failing when registering templates with a short story element #188

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create an instance of FacebookXmlRestClient for an registered
application in facebook
2. Invoke feed_registerTemplateBundle(Collection<String> templates,
Collection<BundleStoryTemplate> shortTemplates, BundleStoryTemplate
longTemplate, List<BundleActionLink> actionLinks)

>> What is the expected output? What do you see instead?

I would have expected it to return the template bundle ID of the
successfully registered template.   Instead it throws the following exception:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><error_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"><error_code>100</error_code><error_msg
>The
short_story_template param needs to be a traditional array of short story
template records, and it appears that you sent a dictionary
instead.</error_msg><request_args
list="true"><arg><key>action_links</key><value>[{"text":"Start playing
{*appName*} and try to catch
up!","href":"http://apps.facebook.com/{*appContext*}/intro.htm?isrc=4"}]</value>
</arg><arg><key>api_key</key><value>0c84b495e93dfb586867063eb39f7437</value></ar
g><arg><key>call_id</key><value>1238771523753</value></arg><arg><key>format</key
><value>xml</value></arg><arg><key>method</key><value>facebook.feed.registerTemp
lateBundle</value></arg><arg><key>one_line_story_templates</key><value>["{*actor
*}
is advancing through
{*appName*}"]</value></arg><arg><key>short_story_templates</key><value>[{}]</val
ue></arg><arg><key>sig</key><value>b53b5881ac54ace65359143dfb63bf51</value></arg
><arg><key>v</key><value>1.0</value></arg></request_args></error_response>com.go
ogle.code.facebookapi.FacebookException:
The short_story_template param needs to be a traditional array of short
story template records, and it appears that you sent a dictionary instead.
    at
com.google.code.facebookapi.FacebookXmlRestClient.parseCallResult(FacebookXmlRes
tClient.java:217)
    at
com.google.code.facebookapi.FacebookXmlRestClient.parseCallResult(FacebookXmlRes
tClient.java:72)
    at
com.google.code.facebookapi.ExtensibleClient.callMethod(ExtensibleClient.java:53
1)
    at
com.google.code.facebookapi.ExtensibleClient.callMethod(ExtensibleClient.java:46
7)

    at
com.google.code.facebookapi.ExtensibleClient.feed_registerTemplateBundle(Extensi
bleClient.java:1523)
    at
ca.bstage.facebook.util.tool.ActionTemplateBundleRegistrationApp.registerBundles
(ActionTemplateBundleRegistrationApp.java:157)
    at
ca.bstage.facebook.util.tool.ActionTemplateBundleRegistrationApp.main(ActionTemp
lateBundleRegistrationApp.java:86)

>> What version of the product are you using? On what operating system?

Version 2.1.0 on Windows XP, Solaris 10, or Linux

>> Please provide any additional information below.

The data I was using for the method call are as follows:

List<String> oneLineTemplates = new ArrayList<String>();
oneLineTemplates.add("{*actor*} is advancing through {*appName*}");

List<BundleStoryTemplate> shortStoryTemplates = new
ArrayList<BundleStoryTemplate>();
BundleStoryTemplate shortStory = new BundleStoryTemplate("{*actor*} is
advancing through {*appName*}", "");
shortStoryTemplates.add(shortStory);

List<BundleActionLink> links = new ArrayList<BundleActionLink>();
BundleActionLink link = new BundleActionLink();
link.setText("Play {*appName*} Now!");
link.setHref("http://apps.facebook.com/mindgames/play.htm");
links.add(link);

feed_registerTemplateBundle(oneLineTemplates, shortStoryTemplates, null, links)

Original issue reported on code.google.com by chris.ho...@gmail.com on 3 Apr 2009 at 3:22

GoogleCodeExporter commented 8 years ago
Certainly a valid bug. I've checked in a JUnitTest for Issue188... and marked 
it as 
@Ignore so that it doesn't cause a failure for now.

Does someone fancy picking this up, removing @Ignore, running the test then 
trying to 
fix the error?

I see the same error here, so the issue is nice and reproducible. Thanks.

Original comment by david.j....@googlemail.com on 6 May 2009 at 6:56

GoogleCodeExporter commented 8 years ago
This might have been fixed now.. but I need to do a build.

Original comment by fern...@gmail.com on 11 Aug 2009 at 9:47

GoogleCodeExporter commented 8 years ago
One current work around is that you must include BOTH templateTitle and 
templateBody
( even just one space, " " ).

Original comment by fern...@gmail.com on 11 Aug 2009 at 9:48

GoogleCodeExporter commented 8 years ago
deprecated method will go away anyhow.

Original comment by fern...@gmail.com on 29 Oct 2009 at 11:57