关闭

Java http post远程请求数据

标签: 编辑器
222人阅读 评论(0) 收藏 举报
分类:

package com;

import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.params.HttpMethodParams;

public class TestMain {

public static void main(String[] args) throws IOException {
    HttpClient hc = new HttpClient();
    hc.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "utf-8");
    PostMethod method = new PostMethod("http://192.168.1.56:7878/BJAZTWS/services/AZTService");
    // method.addParameter("equMapping.equ",baseEquipmentBasic.getEquipmentCode());
    method.addParameter("equMapping.vehicleNumber", "aa");
    int status = hc.executeMethod(method);
    System.out.println(status);
}

}

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:40611次
    • 积分:1363
    • 等级:
    • 排名:千里之外
    • 原创:90篇
    • 转载:2篇
    • 译文:6篇
    • 评论:1条
    文章分类