Don’t use UriTemplate = "/MethodName/Param1/{Param1}/Param2/{JsonObject} for Json input with WCF Service

When building Ajax-enabled WCF service that expect a Json object as input then the following would not work

[OperationContract, WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/Methodname/jsonvariable/{jsonvariable}/param2/{param2}")]
public void MethodName(string jsonvariable, string param2)
{
 
}

Where jsonvariable is a json object passed through jQuery (or ASP.NET Ajax) to a WCF service that looks like this

[{"Name":"za","Email":zubairdotnet@hotmail.com}]

After spending a while I figured out that the following UriTemplate should be used instead

 

[OperationContract, WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/Methodname/?jsonvariable={jsonvariable}&param2={param2}")]
public void MethodName(string jsonvariable, string param2)
{
 
}

My Facebook App – What I’m listening to

I was playing with Nikhil’s Facebook.NET in my spare time for past couple of weeks and built a simple app that can show the music you’re listening to on your Facebook profile.

The application uses ASP.NET AJAX which required a few tweaks to works inside Facebook. Check it out here http://www.facebook.com/apps/application.php?id=15761411287