Chevy Mark Sunderland

Chevy Mark Sunderland

  • 2k
  • 188
  • 159.8k

How To Call .Net Asmx Webservice In Android App

Feb 8 2014 12:21 PM
Hello everyone, I hope in your help.

I've this android application and I need connect to my hosting database with web service Asmx.
The webservice working in test browser.

In this code I don't have error but the output is empty, can you help me?
Thank you

package com.ccmex.myFirstApp;


import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.os.Bundle;
import android.widget.TextView;

public class WebServiceDemoActivity extends Activity {

private final String NAMESPACE = "";
private final String URL = "";
private final String SOAP_ACTION = "";
private final String METHOD_NAME = "StockService";

public void onCreate(Bundle savedInstanceState)

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;

try {

SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);, envelope);

TextView tv = new TextView(this);

} catch (Exception e) {

Answers (2)