I want to consume my json wcf web service from the code behind of my page:
Default.aspx.cs
string result = url + \"/ExecuteAction?callback=?\";
var httpW
I am observing that your problem is with DataType. In your Javascript call, you are setting datType as jsonp
dataType: "jsonp"
And in your Default.aspx.cs file you are sending plain JSON. There is difference between JSON and JSONP.
Try changing JSON type in your Deafult.aspx.cs file and then run. This might resolve your problem.
EDIT: Change your Contract as:
[OperationContract]
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "json")]
public string ExecuteAction(JSONRequest request)
{
String JSONResult = String.Empty;
MethodInfo action = services.GetMethod(action, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
JSONResult =(String)action.Invoke(null, new object[] { args });
}
[DataContract]
public class JSONRequest
{
[DataMember]
public string Action {get; set;}
[DataMember]
public string Args {get; set;}
}