So I was working on this WCF client to talk to the facebook REST api and ran into a really strange issue.
If i utilized the client to call getLoggedInUser it would work when called from an ASP.NET page code behind but it would fail "POST data is missing in the POST" when I tried to call it from within my WCF service host.
For clarification, I have a WCF service that I created and within that service I am calling over to facebook using my WCF REST client.
Basically the client tier is the web browser.
the server tier is the web server with my wcf service and my code behind file.
the server tier uses a facebook WCF REST client to talk to facebook api.
//end of clarification :)
Anyhow so I fired up Fiddler and sure enough, every call from my wcf service over to facebook was being sent as a POST! not a GET.
In the end i had to change my code to this:
public long getLoggedInUser(string sessionKey)
{
Dictionary<string, string> args = CreateArgsDictionary();
args.Add("method","users.getLoggedInUser");
args.Add("session_key",sessionKey);
args.Add("call_id",DateTime.Now.Ticks.ToString());
stringsig = new Signature(args).ToString();
stringqueryString = string.Format
("?method=users.getLoggedInUser&api_key={0}&sig={1}&v=1.0&call_id={2}&session_key={3}"
, args["api_key"], sig,args["call_id"],args["session_key"]);
//HACK:using this instead of WCF.
varrequest = WebRequest.Create(channelFactory.Endpoint.Address.Uri.AbsoluteUri+ queryString);
using(var response= request.GetResponse())
{
varxs = new XmlSerializer(typeof(users_getLoggedInUser_response));
return(xs.Deserialize(response.GetResponseStream())as users_getLoggedInUser_response).value;
}
}