Map<String,Object>queryParams=newHashMap<String,Object>();queryParams.put("paramXml","传送内容");Stringstr=doWebservice("传送url地址",queryParams);

publicStringdoWebservice(Stringurl,Map<String,Object>params)throwsException{Stringstring="";HttpClienthttpclient=HttpClients.createDefault();HttpPosthttppost=newHttpPost(url);Set<Entry<String,Object>>entrySet=params.entrySet();for(Entry<String,Object>entry:entrySet){httppost.setEntity(newStringEntity((String)entry.getValue(),ContentType.TEXT_PLAIN));}try{HttpResponsehttpResponse=httpclient.execute(httppost);intcode=httpResponse.getStatusLine().getStatusCode();if(code==HttpStatus.SC_OK){HttpEntityentity2=httpResponse.getEntity();string=EntityUtils.toString(entity2);//System.out.println(string);}else{thrownewException("HTTPRequestisfailed,Responsecodeis"+code);}}catch(Exceptionex){ex.printStackTrace();}finally{httppost.clone();}returnstring;}