迷糊小妹 2015-09-28 06:45 采纳率: 0%
浏览 1535

How to post data to WCF REST without entity?

[WebInvoke( Method="POST" ,UriTemplate = "Login?lName={loginName}&lPWD={password}&sID={sessionID}&domain={domain}")]
[OperationContract]
public ResultInfo Login(string loginName, string password,string sessionID,string domain)
{
return new ResultInfo()
{
Message = loginName,
OptType = ResultType.FAILED
};
}

and i call service like this:

PostSubmitter post = new PostSubmitter();
post.Url = Constants.SSOCenterURL + "/Login";
post.PostItems.Add("lName", "kkdhf123456");
post.PostItems.Add("lPWD", "edU7qiWjrTzy764cZ7ahEg==");
post.PostItems.Add("sID", "rx543e12xc54235dhd23");
post.PostItems.Add("domain", "localhost");
post.Type = PostSubmitter.PostTypeEnum.Post;
string result = post.Post();

but service NOT get parametes . The 'loginName' will eques NULL.

am i missing something? how to let WCF REST get the post data?

thx your view.

  • 写回答

2条回答 默认 最新

  • Robot-C 2015-09-28 06:47
    关注

    using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;usi......
    答案就在这里:How to use HttpWebRequest to post data to another page which is on another server
    ----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。

    评论

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突