迷糊小妹 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,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。

    评论

报告相同问题?

悬赏问题

  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗