hi,
i want to develop an application which access web services using
ksoap2..... i have simple .net web services running with single method
Add .... the following is code..
package com.Test;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
public class Test extends Activity {
private Button okButton;
private static final String SOAP_ACTION = "http://
10.0.2.2:8000/target.asmx/Add";
private static final String METHOD_NAME = "Add";
private static final String NAMESPACE = "http//
tempuri.org";
private static final String URL = "http://10.0.2.2:8000/
target.asmx";
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
okButton = (Button) findViewById(R.id.but);
okButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
setResult(RESULT_OK);
mymethod();
}
});
}
public static void mymethod() {
SoapObject request = new SoapObject(NAMESPACE,
METHOD_NAME);
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE
(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
} catch (Exception e) {
e.printStackTrace();
}
}
}
while running in emulator giving error as "THE APPLICATION TEST
(PROCESS COM.TEST) HAS STOPPED UNEXPECTEDELY.TRY AGAIN"..... please
tell me where the error may be....
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---