调用方法如下 [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值为空
-
已编辑
静水深澜
2011年12月6日 11:32
-
已更改类型
静水深澜
2011年12月6日 11:35