import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.PostMethod;
public class TestClient {
private static class UTF8PostMethod extends PostMethod {
public UTF8PostMethod(String url) {
super(url);
}
@Override
public String getRequestCharSet() {
return "UTF-8";
}
}
public static void callActive() throws HttpException, IOException {
PostMethod method = new UTF8PostMethod(
"http://10.12.23.70:8080/service/active");
String params = "{tenant:'JINAN112',domain:'crm.qilu.com',admin:'holly_2011@126.com',password:'111aaa'}";
method.setParameter("action", params);
HttpClient httpClient = new HttpClient();
int code = httpClient.executeMethod(method);
System.out.println(method.getResponseBodyAsString());
System.out.println(code);
method.releaseConnection();
}
}