Hi Guys,
Thanks for giving response to me. Finally i got the solution of
calling asp.net web service from android.
Here is my solution.
package com.android.webservice1;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class WebService1 extends Activity {
private static final String URL = "http://dev2.septium.com/test/
TestAndroid.asmx";
private static final String NAMESPACE = "http://septium.com/";
private static final String SOAP_ACTION = "http://septium.com/
MyMethod";
private static final String METHOD_NAME = "MyMethod";
TextView txtView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txtView = (TextView)findViewById(R.id.txtView);
try
{
SoapObject soapObjectRequest = new SoapObject(NAMESPACE,
METHOD_NAME);
SoapSerializationEnvelope soapEnvelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(soapObjectRequest);
HttpTransportSE androidHttpTransport = new HttpTransportSE
(URL);
androidHttpTransport.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)
soapEnvelope.getResponse();
txtView.setText("Status : "+resultString);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
Thanks again.
I hope this solution may help to someone or to you.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en