When i m trying to get Sytem.Array
As data member in Json Class object it gives failure response .
My WCf web-service i am using following method userActivities
which return class Activity
.I have set parameter in class Activity
from Ajax .
[ServiceContract]
public interface IMyService
{
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
Activity userActivities(Activity activity, string action);
}
[DataContract]
partial class Activity
{
}
And in the MyService.cs Class of Service is
public Activity userActivities(Activity activity, string action)
{
if (action.ToLower() == "myactivities")
{
activity.get_MyActivities();
}
return activity;
}
And Class Activity is :
[DataMember]
public int userID;
[DataMember]
public Array _getList_MyActivities;
public void get_MyActivities()
{
_DL_Activity = new DL_Activity();
if (this.userID > 0)
this._getList_MyActivities = _DL_Activity.get_MyActivity(this.userID);
}
Got this post. According to this try decorating your service with
ServiceKnownType
.Something like this
According to your comment you are storing different data types in the array, I guess you will need to put
typeof
for all items in array asServiceKnownType
.Hope this works for you.