我为移动设备创建了一个wcf,这就是代码。
[OperationContract]
[WebInvoke(
Method = "GET",
UriTemplate = "CallPlans",
BodyStyle = WebMessageBodyStyle.Wrapped,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json)]
CallPlanCode CallPlancode();
[DataContract]
public class CallPlanCode
{
[DataMember(Name = "cycle", Order = 0)]
public Cycle cycle { get; set; }
[DataMember(Name = "callplan", Order = 1)]
public List<CallPlan> CallPlan { get; set; }
[DataMember(Name = "MDList", Order = 2)]
public List<MDList> MDList { get; set; }
[DataMember(Name = "HospitalList", Order = 3)]
public List<HospitalList> HospitalList { get; set; }
}
[DataContract]
public class Cycle
{
[DataMember(Name = "startDate", Order = 0)]
public string startDate { get; set; }
[DataMember(Name = "endDate", Order = 1)]
public string endDate { get; set; }
}
[DataContract]
public class CallPlan
{
[DataMember(Name = "transactionPlanID", Order = 0)]
public string transactionPlanID { get; set; }
[DataMember(Name = "mdcode", Order = 1)]
public string mdcode { get; set; }
[DataMember(Name = "hospitalCode", Order = 2)]
public string hospitalCode { get; set; }
[DataMember(Name = "planDate", Order = 3)]
public string planDate { get; set; }
[DataMember(Name = "dayCycle", Order = 4)]
public string dayCycle { get; set; }
[DataMember(Name = "isAlreadyPostedWithSignature", Order = 5)]
public string isAlreadyPostedWithSignature { get; set; }
[DataMember(Name = "callType", Order = 6)]
public string callType { get; set; }
[DataMember(Name = "transactionDayCycle", Order = 7)]
public string transactionDayCycle { get; set; }
[DataMember(Name = "reasonCode", Order = 8)]
public string reasonCode { get; set; }
[DataMember(Name = "postCallNote", Order = 9)]
public string postCallNote { get; set; }
[DataMember(Name = "postCallNote", Order = 10)]
public string preCallNote { get; set; }
}
[DataContract]
public class MDList
{
[DataMember(Name = "FirstName", Order = 1)]
public string FirstName { get; set; }
[DataMember(Name = "LastName", Order = 2)]
public string LastName { get; set; }
[DataMember(Name = "mdcode", Order = 3)]
public string mdcode { get; set; }
[DataMember(Name = "Frequency", Order = 4)]
public string Frequency { get; set; }
[DataMember(Name = "Specialty", Order = 5)]
public string Specialty { get; set; }
[DataMember(Name = "Product1", Order = 6)]
public string Product1 { get; set; }
[DataMember(Name = "Product2", Order = 7)]
public string Product2 { get; set; }
}
[DataContract]
public class HospitalList
{
[DataMember(Name = "hospitalName", Order = 1)]
public string hospitalName { get; set; }
[DataMember(Name = "hospitalCode", Order = 2)]
public string hospitalCode { get; set; }
}
public CallPlanCode CallPlancode()
{
CallPlanCode x = new CallPlanCode();
Cycle a = new Cycle();
a.startDate="123";
a.endDate="123";
List<CallPlan> s = new List<CallPlan>();
s.Add(new CallPlan {transactionPlanID="a"});
List<MDList> b = new List<MDList>();
b.Add(new MDList { FirstName="a"});
List<HospitalList> d = new List<HospitalList>();
d.Add(new HospitalList { hospitalCode="a"});
x.cycle = a;
x.CallPlan = s;
x.MDList = b;
x.HospitalList = d;
return x;
}
当我在fiddler上运行它时显示[Fiddler] ReadResponse()失败:服务器没有返回此请求的响应。服务器返回0字节[504]
有关修复它的任何建议吗?