zoukankan      html  css  js  c++  java
  • WCF返回JSON与传入JSON(普通参数或对象)

    {"__type":"Circle:#MyApp.Shapes","x":50,"y":70,"radius":10
    执行反序列化时,既能识别截断的名称 (#MyApp.Shapes),也能识别完整的名称 (http://schemas.datacontract.org/2004/07/MyApp.Shapes)。
        2.就是参数格式了.
        
    [OperationContract]
    [WebInvoke]
    public void SetDisputSearch(test dsd)
    {
    int i = dsd.i;
    }
    [DataContract]
    public class test
    {
    [DataMember]
    public int i { set; get; }
    [DataMember]
    public int? l { set; get; }
    [DataMember]
    public int? k { set; get; }
    }
    上面这样的方法怎么调用呢,这就是本文的重点了,大家一看就明白了.
    webSer("/Server/Search.svc/SetDisputSearch", null, { "dsd": { "__type": "test:#""i": 1,"k":0} });
    "dsd": { "__type": "test:#""i": 1,"k":0} }其中dsd就是参数名了.后面就是这个对象的信息了.在这个例子里面"__type":"test:#", 不要也能成功的.
     
    分类: .NET
  • 相关阅读:
    Swift
    Swift
    Swift
    Swift
    Swift
    Swift
    Swift
    C++生产和使用的临时对象
    RecyclerView0基于使用
    Docker创建MySQL集装箱
  • 原文地址:https://www.cnblogs.com/Leo_wl/p/2492610.html
Copyright © 2011-2022 走看看