通过Post方式调用webservice
来源:互联网 发布:矩阵分解推荐算法 编辑:程序博客网 时间:2024/05/16 04:12
需要用到的jar包:
commons-codec-1.4.jar
commons-httpclient-3.1.jar
commons-logging-1.0.4.jar
jsoup-1.6.2.jar
/** * 通过Post方式请求webserviec方法 * @param methodPost 接口地址+"/"+请求的方法名 * @param host * @param params 请求参数 * @return * @throws HttpException * @throws IOException */public String webServicePost(String postMethod, String host, Map<String, String> params) throws HttpException, IOException { InputStream is = null; HttpClient client = new HttpClient(); PostMethod method = new PostMethod(postMethod); method.setRequestHeader("Host", host); method.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); for (String key : params.keySet()) { method.setParameter(key, params.get(key)); } client.executeMethod(method); is = method.getResponseBodyAsStream(); org.jsoup.nodes.Document document = Jsoup.parse(is, "utf-8", ""); if (is != null) is.close(); return document.toString(); }
阅读全文
0 0
- 通过Post方式调用webservice
- POST方式调用WebService
- Java 以post请求方式通过json格式调用Webservice接口
- WEBSERVICE GET、POST、SOAP方式调用
- 通过客户端编程的方式调用webservice
- 通过客户端编程的方式调用webservice
- 通过客户端编程方式调用webService
- .NET WebService 调试,允许通过IE输入参数的设置,允许Perl以Post方式调用的配置项
- .Net下采用GET/POST/SOAP方式动态调用WebService
- C# 使用Get,Post,Soap方式调用WebService
- python3.x 使用http-post方式调用webservice
- C# 使用Get,Post,Soap方式调用WebService
- 通过webservice调用ODI方案的实现方式
- java调用Myeclipse通过jax-ws方式搭建的webservice
- 通过get或post的方式来调用web service
- 通过jQuery以HTTP GET/POST方式调用WCF服务
- 通过SSL调用WebService
- 通过Ajax调用webService
- Tomcat Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- Roads and Libraries(最小生成树)
- MVC 从控制器将数据对象赋值给前端JS对象
- Redis主从同步数据详解
- HR是这样筛选简历的,不知道就完蛋!
- 通过Post方式调用webservice
- 进制互转
- 面试题总结2
- JAVA web项目中的no result defined for action xxxAction and result input 错误
- 数组指针指针数组
- Web前端知识体系精简
- github上十二款最著名的Android播放器开源项目
- android使用webview加载H5页面
- 关于MySQL数据库性能优化总结