【发布时间】:2015-08-21 06:06:06
【问题描述】:
我的问题是我想将带有序列化对象的发布请求发送到 WCF 方法 这是我的代码。
[Serializable]
public class StandardCardModel
{
public string lang { get; set; }
public string app_source { get; set; }
public string card { get; set; }
}
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebInvoke(Method = "POST",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "GetLastTransactions")]
LastTransactionsResult GetLastTransactions(StandardCardModel scm);
现在我想用参数调用“GetLastTransactions”:
{
"lang": "en",
"app_source": "TestSource",
"card": "1111"
}
明确地说,我不想发送带有参数名称的 JSON 作为对象。例如:
{"scm":{....}}
我在 scm 中得到空值。有什么建议?谢谢
【问题讨论】:
-
我找到了我的问题的答案 [这里][1]。谢谢[1]:stackoverflow.com/questions/13915765/…
标签: c# json wcf serialization