求一个Android调用.net写的webservice的例子

ljw_pulse 2014-03-11 10:00:26
需要一个Android调用.net写的webservice的例子,要客户端与服务端的源码,最好是您调试过的,谢谢了!源码接口要求很简单,只要能传递2个参数过去并能返回来信息就行了。
谢谢了!很急!
请发我邮箱:56949560,QQ的邮箱。
...全文
132 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
teemai 2014-03-12
  • 打赏
  • 举报
回复
写这么多不太现实。太耗时间了。 你在android里直接调用http请求即可啊。 实例代码:

/**
	 * A HTTP request(POST) with given URL
	 * 
	 * @param strUrl
	 *            the URL you want to request
	 * @return
	 */
	public static String post(String url) throws ClientProtocolException, IOException {
		String result = "";
		HttpPost request = new HttpPost(url);
		HttpParams httpParameters = new BasicHttpParams();
		// Set the timeout in milliseconds until a connection is established.
		int timeoutConnection = 10 * 1000;
		HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);

		// Set the default socket timeout in milliseconds which is the timeout
		// for waiting for data.
		int timeoutSocket = 10 * 1000;
		HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);

		HttpClient httpClient = new DefaultHttpClient(httpParameters);
		HttpResponse response = httpClient.execute(request);

		if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			result = EntityUtils.toString(response.getEntity());
		}

		return result;
	}
ljw_pulse 2014-03-12
  • 打赏
  • 举报
回复
没有人帮忙吗?急呀!
ljw_pulse 2014-03-12
  • 打赏
  • 举报
回复
已解决了,谢谢大家!是我们代码写的有错误,传参数的方式不对。现在可以了。

80,350

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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