my code stock.com

Llamando a un servicio

Snippet options

Download: Download snippet as soap.java.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

/*


	String NAMESPACE = "http://gis.mardelplata.gob.ar/";
	String URL = "http://gis.mardelplata.gob.ar/webservice/2.php";
	String METHOD_NAME = "movilpolicial_lat_lng";
	String SOAP_ACTION = URL + "/" + METHOD_NAME;
	String LAT = "";
	String LNG = "";

*/

private class TareaWSConsulta extends AsyncTask<String, Integer, String>
	{
		ProgressDialog pd;

		@Override
		protected void onPreExecute()
		{
			pd = new ProgressDialog(LayMain.this);
			pd.show();
			super.onPreExecute();
		}

		protected String doInBackground(String... params)
		{
			try
			{
				SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
				request.addProperty("latitud", LAT);
				request.addProperty("longitud", LNG);
				request.addProperty("token", "wwfe345gQ3ed5T67g4Dase45F6fer");

				SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
				envelope.dotNet = true;
				envelope.setOutputSoapObject(request);
				HttpTransportSE transporte = new HttpTransportSE(URL);
				transporte.call(SOAP_ACTION, envelope);
				
				String resultado_xml = envelope.getResponse().toString();
				return resultado_xml.toString();
			}
			catch (Exception e)
			{
				Log.e("SOAP", "SOAP");
				e.printStackTrace();
			}
			return "";
		}

		protected void onPostExecute(String result)
		{
			pd.dismiss();
		}
	}

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.