This coding i got from here. I get error in log cat view like the one i mentioned after the coding.. please provide me some suggestion to clear this..
package com.example.firstws;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
public class Firstws extends Activity {
/** Called when the activity is first created. */
private static final String SOAP_ACTION="http://tempuri.org/CelsiusToFarenheit";
private static final String METHOD_NAME="CelsiusToFarenheit";
private static final String NAMESPACE="http://tempuri.org/";
private static final String URL="http://www.w3schools.com/webservices/tempconvert.asmx";
TextView tv=(TextView)findViewById(R.id.textView1);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SoapObject Request=new SoapObject(NAMESPACE,METHOD_NAME);
Request.addProperty("Celsius","32");
SoapSerializationEnvelope soapEnvelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet=true;
soapEnvelope.setOutputSoapObject(Request);
AndroidHttpTransport aht=new AndroidHttpTransport(URL);
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString=(SoapPrimitive)soapEnvelope.getResponse();
tv.setText("Status:"+resultString);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Error:
java.lang.runtime exception: unable to instantiate the activity componentinfo{com.example.firstws/com.example.firstws.Firstws}: java.lang.NullpointerException