packagecom.aiait.ivs.util;importjava.io.BufferedReader;importjava.io.File;importjava.io.FileInputStream;importjava.io.IOException;importjava.io.InputStreamReader;importjava.io.OutputStream;importjava.io.OutputStreamWriter;importjava.net.HttpURLConnection;importjava.net.MalformedURLException;importjava.net.URL;importjava.net.URLConnection;importorg.apache.commons.httpclient.HttpClient;importorg.apache.commons.httpclient.NameValuePair;importorg.apache.commons.httpclient.methods.PostMethod;importorg.apache.log4j.Logger;public classHttpUtil {private static final Logger logger = Logger.getLogger(HttpUtil.class);//请求soap接口用这个方法
public staticString soapPostSendXml(String SOAPUrl,String parXmlInfo){
StringBuilder result= newStringBuilder();try{
String SOAPAction= "submitMs";//Create the connection where we're going to send the file.
URL url = newURL(SOAPUrl);
URLConnection connection=url.openConnection();
HttpURLConnection httpConn=(HttpURLConnection) connection;//how big it is so that we can set the HTTP Cotent-Length//property. (See complete e-mail below for more on this.)//byte[] b = bout.toByteArray();
byte[] b = parXmlInfo.getBytes("ISO-8859-1");//Set the appropriate HTTP parameters.
httpConn.setRequestProperty( "Content-Length",String.valueOf( b.length ) );
httpConn.setRequestProperty("Content-Type"