public String sendMessageByWebService2(String phone, String msg,
String... args){
String webserviceUrl = PropertiesHandle.readValue("SMS.webserviceurl");
String userName = PropertiesHandle
.readValue("SMS.webserviceusername");
String mainCode = PropertiesHandle
.readValue("SMS.webservicemaincode");
String pwd = PropertiesHandle.readValue("SMS.webservicepwd");
String RmTfh = PropertiesHandle.readValue("SMS.webservicermtfh");
String result = "";
URL url = null;
StringBuffer sb = new StringBuffer();
sb.append("");
sb
.append("");
sb.append("");
sb
.append("");
sb.append(""+mainCode+"");
sb.append(""+pwd+"");
sb.append("");
sb.append("");
try {
url = new URL(webserviceUrl);
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
URLConnection uc = null;
OutputStreamWriter out = null;
BufferedReader rd = null;
try {
uc = url.openConnection();
uc.setDoOutput(true); // ....必须设置为'true'.
uc.setRequestProperty("Content-Type", "text/xml"); // 记住这行不能少否则会出错
out = new OutputStreamWriter(uc.getOutputStream(), "utf-8");
out.write(sb.toString());
out.flush();
out.close();
rd = new BufferedReader(new InputStreamReader(uc.getInputStream(),
"utf-8"));
StringBuffer responseStr = new StringBuffer();
String str;
while ((str = rd.readLine()) != null) {
responseStr.append(str);
}
result = responseStr.substring(responseStr.indexOf("") + 8,
responseStr.indexOf(""));
System.out.println(result);
rd.close();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}