here you can send soap msg message.
public String setSoapMsg(String targetURL, String urlParameters){ URL url; HttpURLConnection connection = null; try { //Create connection url = new URL(targetURL); // for not trusted site (https) // _FakeX509TrustManager.allowAllSSL(); // System.setProperty("javax.net.debug","all"); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("SOAPAction", "**** SOAP ACTION VALUE HERE ****"); connection.setUseCaches (false); connection.setDoInput(true); connection.setDoOutput(true); //Send request DataOutputStream wr = new DataOutputStream ( connection.getOutputStream ()); wr.writeBytes (urlParameters); wr.flush (); wr.close (); //Get Response InputStream is ; Log.i("response", "code="+connection.getResponseCode()); if(connection.getResponseCode()<=400){ is=connection.getInputStream(); }else{ /* error from server */ is = connection.getErrorStream(); } // is= connection.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); String line; StringBuffer response = new StringBuffer(); while((line = rd.readLine()) != null) { response.append(line); response.append('\r'); } rd.close(); Log.i("response", ""+response.toString()); return response.toString(); } catch (Exception e) { Log.e("error https", "", e); return null; } finally { if(connection != null) { connection.disconnect(); } } }
hope this helps. if someone asks the question allowAllSSL() , google it :).
HelmiB Jan 24 '11 at 4:29 2011-01-24 04:29
source share