0

Hi my webservice when tested using the SoapUI is giving perfect output ,But when i am trying to access from the code it is giving nullpointer exception, not sure what am i doing wrong below is my code and working URL.

public class Insertdata extends AsyncTask<String, String, String> {  

        private final String NAMESPACE = "http://tempuri.org";
        private final String URL = "http://10.188.7.102/GetCarpoolDetails/GetCarpoolDetailsService.svc?wsdl";
        private final String SOAP_ACTION = "http://tempuri.org/IGetCarpoolDetailsService/getUserDetails";
        private final String METHOD_NAME = "getUserDetails";
        HttpResponse response = null;
        String result = null;
        String status;

    @Override
    protected String doInBackground(String... params) {

        SoapObject soapObject;
        soapObject = new SoapObject(NAMESPACE, METHOD_NAME);

        soapObject.addProperty("Empid","44");

   SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.implicitTypes = true;
        envelope.setOutputSoapObject(soapObject);

        System.out.println("envelope---------"+envelope.bodyOut);

         HttpTransportSE androidHttpTransport;
        androidHttpTransport = new HttpTransportSE(URL);

        try{
            androidHttpTransport.call(SOAP_ACTION, envelope);
            SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
            status = response.toString();

            System.out.println("status==========="+status);

            System.out.println("Posted Ride Sucsessfully");

       }
        catch(Exception e){
            System.out.println("checking error====="+e.toString());
       }
        return null;

   }

 }

Below is my stackTrace

02-17 09:31:32.863: I/System.out(5219): envelope---------getUserDetails{Empid=44; }
02-17 09:31:32.883: D/dalvikvm(5219): GC_FOR_ALLOC freed 297K, 14% free 2694K/3132K, paused 25ms, total 25ms
02-17 09:31:33.113: I/System.out(5219): checking error=====java.lang.NullPointerException

Any help is really really appreciated.

Abhishek Asthana
  • 1,857
  • 1
  • 31
  • 51
teekib
  • 2,821
  • 10
  • 39
  • 75

0 Answers0