eyhan / facebook-java-api

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

Incorrect Signature #334

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. jsonClient.users_setStatus("Testing my App !!!");

What is the expected output? What do you see instead?
Don't know... as this is my first app. May be it will set my status as "Testing 
my App !!!" on facebook.

I wanted to create app for mobile which sets my status through my app.
Not sure how to approach using Java and J2ME.

NOTE : on facebook my application don't show any Desktop Mode !!!  

What version of the product are you using? On what operating system?
Tried different, last one being facebook-java-api-2.0.3-SNAPSHOT + 
facebook-java-api-schema-2.0.3-SNAPSHOT. also tried similar 3.* version.

Please provide any additional information below.
Code :
import com.google.code.facebookapi.FacebookException;
import com.google.code.facebookapi.FacebookJsonRestClient;
import com.google.code.facebookapi.IFacebookRestClient;
//import com.google.code.facebookapi.ProfileField;
//import com.google.code.facebookapi.schema.User;
import java.io.IOException;
//import java.util.EnumSet;
import java.util.logging.Level;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.params.HttpClientParams;
import org.apache.log4j.Logger;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author at229513
 */
public class fbLogin {

    private IFacebookRestClient client;
    //private FacebookXmlRestClient xmlClient;
    //private User loggedUser = null;
    //public static EnumSet<ProfileField> fields = EnumSet.allOf(ProfileField.class);
    private static Logger logger = Logger.getLogger(fbLogin.class);
    //private PropertiesFileManager propertiesManager;
    private boolean isConnected = false;
    private String session;
    private String api_key = "<app_key>";
    private String login_url = "http://www.facebook.com/login.php";
    private String secret = "<secret>";

    public boolean connect(String login,String pass) throws HttpException, IOException, FacebookException
        {

                System.out.println("Connecting...");
                client =new FacebookJsonRestClient(api_key,secret);
                System.out.println("Client created... ");
                String token = client.auth_createToken();
                System.out.println("token = " + token);

        HttpClient http = new HttpClient();
                           http.setParams(new HttpClientParams());
                           http.setState(new HttpState());

        GetMethod get = new GetMethod("http://www.facebook.com/login.php?api_key="+ api_key + "&v=1.0&auth_token=" + token);

        http.executeMethod(get);

        PostMethod post = new PostMethod(login_url);
                        post.addParameter(new NameValuePair("api_key", api_key));
                        post.addParameter(new NameValuePair("v", "1.0"));
                        post.addParameter(new NameValuePair("auth_token", token));
                        post.addParameter(new NameValuePair("email",login));
                        post.addParameter(new NameValuePair("pass", pass));

        http.executeMethod(post);
        System.out.println("method post OK");

        // fetch session key
        session = client.auth_getSession(token);
        System.out.println("Session key is " + session);
        //xmlClient= new FacebookXmlRestClient(api_key,secret,session);
        FacebookJsonRestClient jsonClient = new FacebookJsonRestClient(api_key, secret, session);
        System.out.println("fbclient created...");
        jsonClient.users_setStatus("Testing my App !!!");
        isConnected= true;

                return isConnected;
        }

    public static void main(String [] args) {

        fbLogin fbL = new fbLogin();
        try {

            boolean boo = fbL.connect("<email>", "<password>");
            if(boo)
                System.out.println("!!! Connected !!!");
            else
                System.out.println("!!! Not Connected !!!");
        } catch (HttpException ex) {
            System.out.println("HttpException : "+ex.getMessage());
            java.util.logging.Logger.getLogger(fbLogin.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            System.out.println("IOException : "+ex.getMessage());
            java.util.logging.Logger.getLogger(fbLogin.class.getName()).log(Level.SEVERE, null, ex);
        } catch (FacebookException ex) {
            System.out.println("FacebookException : "+ex.getMessage());
            java.util.logging.Logger.getLogger(fbLogin.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}

Original issue reported on code.google.com by abhi007t...@gmail.com on 6 Sep 2010 at 9:43

GoogleCodeExporter commented 8 years ago
Please can someone help me!!!
This is urgent

Original comment by abhi007t...@gmail.com on 8 Sep 2010 at 2:51

GoogleCodeExporter commented 8 years ago
I have the same problem. Did you solved it ? Any solution ?

Original comment by mathias....@gmail.com on 16 Sep 2010 at 11:30

GoogleCodeExporter commented 8 years ago
this is a serious problem, maybe FaceBook had update lead to apper this bug. 

Original comment by g.huangy...@gmail.com on 20 Dec 2010 at 2:36