0

I am trying to make an app that makes a call to a web service but I keep getting java.lang.NullPointerException. I had earlier used similar code for another websevice but that didn't give a problem, so I can't figure out what I've done wrong

My code is:

a1=(EditText)findViewById(R.id.code);
a2=(EditText)findViewById(R.id.pwd);
String ac=a1.getText().toString();
String bn=a2.getText().toString();

String SOAP_ACTION = "http://www.airindia.in/getFFP";
String OPERATION_NAME = "getFFP";
String WSDL_TARGET_NAMESPACE = "http://www.airindia.in/";
String SOAP_ADDRESS = "http:// 203.199.104.203/ffp-details.asmx";
SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
request.addProperty("membercode",ac);
request.addProperty("pwd",bn);
request.addProperty("pass_key", "URFFPDetails@AirIndia");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
try
{
    httpTransport.debug = true;
    httpTransport.call(SOAP_ACTION, envelope);
    String ss = httpTransport.responseDump;
    TextView l1 = (TextView) findViewById(R.id.result);
    l1.setText(ss);
    l1.setVisibility(View.VISIBLE); 
}
catch (Exception exception) {
    exception.printStackTrace();   
} 

And the exception raised in logcat is:

07-31 10:04:23.029: W/System.err(6944): java.lang.NullPointerException
07-31 10:04:23.029: W/System.err(6944):     at libcore.net.http.HttpConnection$Address.hashCode(HttpConnection.java:343)
07-31 10:04:23.029: W/System.err(6944):     at java.util.HashMap.get(HashMap.java:298)
07-31 10:04:23.029: W/System.err(6944):     at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:67)
07-31 10:04:23.029: W/System.err(6944):     at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
07-31 10:04:23.029: W/System.err(6944):     at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
07-31 10:04:23.029: W/System.err(6944):     at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
07-31 10:04:23.029: W/System.err(6944):     at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
07-31 10:04:23.029: W/System.err(6944):     at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
07-31 10:04:23.029: W/System.err(6944):     at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
07-31 10:04:23.039: W/System.err(6944):     at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:76)
07-31 10:04:23.039: W/System.err(6944):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:152)
07-31 10:04:23.039: W/System.err(6944):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)
07-31 10:04:23.039: W/System.err(6944):     at com.example.ffp.MainActivity.go(MainActivity.java:120)
07-31 10:04:23.039: W/System.err(6944):     at java.lang.reflect.Method.invokeNative(Native Method)
07-31 10:04:23.039: W/System.err(6944):     at java.lang.reflect.Method.invoke(Method.java:511)
07-31 10:04:23.039: W/System.err(6944):     at android.view.View$1.onClick(View.java:3058)
07-31 10:04:23.039: W/System.err(6944):     at android.view.View.performClick(View.java:3534)
07-31 10:04:23.039: W/System.err(6944):     at android.view.View$PerformClick.run(View.java:14263)
07-31 10:04:23.039: W/System.err(6944):     at android.os.Handler.handleCallback(Handler.java:605)
07-31 10:04:23.039: W/System.err(6944):     at android.os.Handler.dispatchMessage(Handler.java:92)
07-31 10:04:23.039: W/System.err(6944):     at android.os.Looper.loop(Looper.java:137)
07-31 10:04:23.039: W/System.err(6944):     at android.app.ActivityThread.main(ActivityThread.java:4441)
07-31 10:04:23.039: W/System.err(6944):     at java.lang.reflect.Method.invokeNative(Native Method)
07-31 10:04:23.039: W/System.err(6944):     at java.lang.reflect.Method.invoke(Method.java:511)
07-31 10:04:23.049: W/System.err(6944):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-31 10:04:23.049: W/System.err(6944):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-31 10:04:23.049: W/System.err(6944):     at dalvik.system.NativeStart.main(Native Method)

0 Answers0