小编Bod*_*den的帖子

WCF复杂JSON INPUT错误(不能由QueryStringConverter转换)

我有问题解决复杂JSON作为我的WCF服务中的参数.

在Visual Studio 2008 SP1中使用Microsoft.Net 3.5 SP1

使用以下合同:

[ServiceContract]
public interface IService1
{

    [OperationContract]
    [WebGet(UriTemplate="GetDataUsingDataContract?composite={composite}", 
        BodyStyle=WebMessageBodyStyle.Wrapped, 
        RequestFormat=WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
    CompositeType GetDataUsingDataContract(CompositeType composite);

    // TODO: Add your service operations here
}

// Use a data contract as illustrated in the sample below to add composite types to service operations
[DataContract]
public class CompositeType
{
    string boolValue = "true";
    string stringValue = "Hello ";

    [DataMember]
    public string BoolValue
    {
        get { return boolValue; }
        set { boolValue = value; }
    } …
Run Code Online (Sandbox Code Playgroud)

wcf json

11
推荐指数
1
解决办法
2万
查看次数

标签 统计

json ×1

wcf ×1