日期:2014-05-18 浏览次数:20794 次
SSLContext sc = SSLContext.getInstance("SSL");
//指定信任https
sc.init(null, new TrustManager[]{new MyX509TrustManager()}, new java.security.SecureRandom());
URL console = new URL(Url+actionString);
HttpsURLConnection httpsConn = (HttpsURLConnection) console.openConnection();
//HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
httpsConn.setSSLSocketFactory(sc.getSocketFactory());
//http = (HttpsURLConnection) console.openConnection();
((HttpsURLConnection) httpsConn).setHostnameVerifier(DO_NOT_VERIFY);
//设置SOAPAction参数
// httpsConn.set
httpsConn.setConnectTimeout(connectionTimeOut);
httpsConn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
httpsConn.setRequestProperty("charset", "UTF-8");
httpsConn.setRequestProperty("SOAPAction", soapAction + actionString);
httpsConn.setRequestProperty("Host", soapHost);
httpsConn.setRequestProperty("ContentLength", Integer.toString(rqinfo.length));
httpsConn.setReadTimeout(30000);
httpsConn.setRequestMethod("POST");
httpsConn.setDoOutput(true);
httpsConn.setDoInput(true);
httpsConn.setConnectTimeout(connectionTimeOut);
httpsConn.setRequestProperty("Content-Type", "text/xml");
httpsConn.setRequestProperty("charset", "UTF-8");
httpsConn.setRequestProperty("SOAPAction", soapAction + actionString);//确保你这个地方的字符串正确
httpsConn.setRequestProperty("Host", soapHost);
&nb