Need Android code to call web service
<p>Hi I am using source a web service at <code>http://190.86.208.141/qs/wsuser.asmx</code> and I want to call Register method of this web service.</p>

<p>But I run the below code the <code>ReturnMessage</code> is returning <code>Object reference not set to an instance of an object</code> but the <code>ReturnCode</code> is coming 0 which means operation is succesful. </p>

<p>Is there any problem in server side or problem lies in my code. Here is my code.
Please help me.Thanks in advance.</p>

<pre><code>public class Registration extends Activity{

    VideoView videoView;
    String SOAP_ACTION = "http://tempuri.org/Register";
    String NAMESPACE = "http://tempuri.org/";
    String METHOD_NAME = "Register";
    String URL = "http://190.86.208.141/qs/wsuser.asmx";     

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        request.addProperty("FirstName", "Soumen");
        request.addProperty("LastName", "Pyne");
        request.addProperty("Email", "soumen.pyne1@navsoft.in");
        request.addProperty("Password", "16nov1988");
        request.addProperty("Language", "Bengali");
        request.addProperty("City", "London");
        request.addProperty("ConfirmationCode", "123");

        ReturnValue rv = new ReturnValue();        

        PropertyInfo pi = new PropertyInfo();
        pi.setName("objReturnValue");
        pi.setValue(rv); 

        pi.setType(rv);
        pi.setNamespace(NAMESPACE);
        request.addProperty(pi);
        request.addProperty("application", "zxcv");
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet  = true;
        Marshal floatMarshal = new MarshalFloat();
        envelope.setOutputSoapObject(request);
        floatMarshal.register(envelope);
        envelope.addMapping(NAMESPACE, "ReturnValue", new ReturnValue().getClass());
        HttpTransportSE aht = new HttpTransportSE(URL);

        try {
            aht.debug = true;
            aht.call(SOAP_ACTION, envelope);
            String g = aht.responseDump;
            System.out.println("Request dump = "+aht.requestDump);
            System.out.println("Response dump = "+g);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (XmlPullParserException e) {
            e.printStackTrace();
        }

        try {
            System.out.println("response = "+result.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (envelope.bodyIn instanceof SoapFault) {
            String str= ((SoapFault) envelope.bodyIn).faultstring;
            Log.i("WS FAULT", str);
        } else {
            SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
            Log.d("WS", String.valueOf(resultsRequestSOAP));
        }
    }
}
</code></pre>

<p>AND my RetrunValue calss is below</p>

<pre><code>package com.hello.test;

import java.util.Hashtable;
import java.util.Vector;
import org.ksoap2.serialization.KvmSerializable;
import org.ksoap2.serialization.PropertyInfo;

public class ReturnValue  implements KvmSerializable{
    public int ReturnCode;
    public String ReturnMessage;
    public ReturnValue(){}
    public ReturnValue(int retunCode , String returnMessage){
        ReturnCode = retunCode;
        ReturnMessage = returnMessage;
    }
    @Override
    public Object getProperty(int arg0) {   
        switch(arg0)
        {
            case 0:
                return ReturnCode;
            case 1:
                return ReturnMessage;
        }
        return null;
    }

    @Override
    public int getPropertyCount() {
        // TODO Auto-generated method stub
        return 2;
    }
    @Overide
    public void getPropertyInfo(int index, Hashtable arg1, PropertyInfo info) {
         switch(index)
         {
             case 0:
                 info.type = PropertyInfo.INTEGER_CLASS;
                 info.name = "ReturnCode";
                 break;
             case 1:
                 info.type = PropertyInfo.STRING_CLASS;
                 info.name = "ReturnMessage";
                 break;
             default:
                 break;
         }
    }
    @Override
    public void setProperty(int index, Object value) {
        switch(index)
        {
            case 0:
                ReturnCode = Integer.parseInt(value.toString());
                break;
            case 1:
                ReturnMessage = value.toString();
                break;
            default:
                break;
        }
    }
}
</code></pre>
