WCF收不到POST传值,求解

moonface007 2011-12-06 07:38:30
调用方法如下
[OperationContract(Name = "SendMessage")]

[WebInvoke(Method= "POST",ResponseFormat=WebMessageFormat.Json,RequestFormat=WebMessageFormat.Json,UriTemplate = "SendMessage?message={message}", BodyStyle = WebMessageBodyStyle.Wrapped)]

String SendMessage(String message);

JAVA中调用:

HttpPost post = new HttpPost(BASE_URL+"/SendMessage?message=");

List<NameValuePair> value=new ArrayList<NameValuePair>();

value.add(new BasicNameValuePair("message","hello"));

try
{

HttpEntity httpcode=new UrlEncodedFormEntity(value,HTTP.UTF_8);

post.setEntity(httpcode);

HttpResponse httpResponse = client.execute(post);

statusCode = httpResponse.getStatusLine().getStatusCode();

if(statusCode==HttpStatus.SC_OK)

{

result = retrieveInputStream(httpResponse.getEntity());

}

}catch(Exception e)

{

}

可以调用,但String SendMessage(String message);中message值为空
...全文
149 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧