Got error while calling the .NET web Service with KSOAP2 in android
<p><strong>This is the User class defined in .net</strong></p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Properties
{

    public class User
    {
        private int userId;
        private String location;
        private String firstName;
        private String lastName;
        private String email;
        private String password;
        private int userType;
        private int loginStatus;
        private String login;


        public int UserId
        {
            get
            {
                return userId;
            }

            set
            {
                userId = value;
            }

        }

        public String Location
        {
            get
            {
                return location;
            }

            set
            {
                location = value;
            }

        }

        public String FirstName
        {
            get
            {
                return firstName;
            }

            set
            {
                firstName = value;
            }

        }

        public String LastName
        {
            get
            {
                return lastName;
            }

            set
            {
                lastName = value;
            }
        }

        public String Email
        {
            get
            {
                return email;
            }

            set
            {
                email = value;
            }
        }

        public String Password
        {
            get
            {
                return password;
            }

            set
            {
                password = value;
            }
        }


        public int UserType
        {
            get
            {
                return userType;
            }

            set
            {
                userType = value;
            }

        }

        public int LoginStatus
        {
            get
            {
                return loginStatus;
            }

            set
            {
                loginStatus = value;
            }

        }


        public String Login
        {
            get
            {
                return login;
            }

            set
            {
                login = value;
            }

        }
    }

}
</code></pre>

<p><strong>This is the method signature of web Service in .net</strong></p>

<pre><code> [OperationContract]
        int addUser(User user);
</code></pre>

<p>This method add user information to database.</p>

<p>I want to call this web service method in android</p>

<p><strong>Here is the user class defination</strong></p>

<pre><code>package com.webservice;

import java.util.Hashtable;

import org.ksoap2.serialization.KvmSerializable;
import org.ksoap2.serialization.PropertyInfo;

public class User implements KvmSerializable {

    public int userId;
    public String location;
    public String firstName;
    public String lastName;
    public String email;
    public String password;
    public int userType;
    public int loginStatus;
    public String login;

    public User() {
    }

    public User(int userId, String location, String firstName, String lastName,
            String email, String password, int userType, int loginStatus,
            String login) {
        this.userId = userId;
        this.location = location;
        this.firstName = firstName;
        this.lastName = lastName;
        this.email = email;
        this.password = password;
        this.userType = userType;
        this.loginStatus = loginStatus;
        this.login = login;

    }

    public Object getProperty(int arg0) {
        switch (arg0) {
        case 0:
            return userId;
        case 1:
            return location;
        case 2:
            return firstName;
        case 3:
            return lastName;
        case 4:
            return email;
        case 5:
            return password;
        case 6:
            return userType;
        case 7:
            return loginStatus;
        case 8:
            return login;
        }

        return null;
    }

    public int getPropertyCount() {
        // TODO Auto-generated method stub
        return 9;
    }

    public void getPropertyInfo(int index, Hashtable arg1, PropertyInfo info) {
        switch (index) {
        case 0:
            info.type = PropertyInfo.INTEGER_CLASS;
            info.name = "userId";
            break;
        case 1:
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "location";
            break;
        case 2:
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "firstName";
            break;
        case 3:
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "lastName";
            break;
        case 4:
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "email";
            break;
        case 5:
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "password";
            break;
        case 6:
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "userType";
            break;
        case 7:
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "login";
            break;
        default:
            break;
        }
    }

    public void setProperty(int index, Object value) {
        switch (index) {
        case 0:
            userId = Integer.parseInt(value.toString());
            break;
        case 1:
            firstName = value.toString();
            break;
        case 2:
            lastName = value.toString();
            break;
        case 3:
            email = value.toString();
            break;
        case 4:
            password = value.toString();
            break;
        case 5:
            userType = Integer.parseInt(value.toString());
            break;
        case 6:
            loginStatus = Integer.parseInt(value.toString());
            break;
        case 7:
            login = value.toString();
            break;
        default:
            break;
        }
    }

}
</code></pre>

<p><strong>Here is the activity code</strong></p>

<pre><code>public class WebServiceDemoActivity extends Activity {
    /** Called when the activity is first created. */

    private static String SOAP_ACTION3 = "http://tempuri.org/IServiceLibrary/addUser";
    private static String NAMESPACE = "http://tempuri.org/";    
    private static String METHOD_NAME3 = "addUser";
    private static String URL = "http://xxx.xxx.xxx.xxx:8030/ServiceLibrary/Service1.svc?wsdl";

    Button btnFar, btnCel, btnClear;
    EditText txtFar, txtCel;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        btnFar = (Button) findViewById(R.id.btnFar);        

        btnFar.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {

                    long messageId = 0;
                    Boolean messageSpecified;
                    User user = new User();
                    user.email = "arunm@camo.com";
                    user.location = "banaglore";
                    user.firstName = "arun";
                    user.lastName = "m";
                    user.login = "arun";
                    user.password = "camo@india";
                    user.userType = 0;
                    user.loginStatus = 1;


                    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME3); 
                    PropertyInfo propertyInfo = new PropertyInfo();
                    propertyInfo.setName("user");
                    propertyInfo.setValue(user);
                    propertyInfo.setType(user.getClass());
                    request.addProperty(propertyInfo);


                    SoapSerializationEnvelope envelope = 
                        new SoapSerializationEnvelope(SoapEnvelope.VER11); 
                    envelope.dotNet=true;
                    envelope.setOutputSoapObject(request);
                    envelope.addMapping(NAMESPACE, "User", user.getClass(), new Marshal(

                    ) {

                        public void writeInstance(XmlSerializer arg0, Object arg1)
                                throws IOException {
                            // TODO Auto-generated method stub

                        }

                        public void register(SoapSerializationEnvelope arg0) {
                            // TODO Auto-generated method stub

                        }

                        public Object readInstance(XmlPullParser arg0, String arg1, String arg2,
                                PropertyInfo arg3) throws IOException, XmlPullParserException {
                            // TODO Auto-generated method stub
                            return null;
                        }
                    });
                    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
                    SoapFault soapFault=null;
                    SoapObject soapObject=null;
                    try {
                        androidHttpTransport.call(SOAP_ACTION3, envelope);
                        Object body = envelope.bodyIn;
                        if(body instanceof SoapObject)
                            soapObject = (SoapObject) envelope.bodyIn;
                        else if(body instanceof SoapFault){
                            soapFault = (SoapFault)envelope.bodyIn;
                            System.out.println("Error encountered is:"+soapFault.faultstring);
                            //Toast.makeText(getApplicationContext(), "", duration)
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        System.out.println("Error encountered is:"+e.getMessage());
                    }

                    if (messageId == -1) {
                        Toast.makeText (getApplicationContext(), "Failed to send message", Toast.LENGTH_SHORT);
                    } else {
                        Toast.makeText (getApplicationContext(), "Message sent successfully, message id is:"+messageId, Toast.LENGTH_SHORT);
                    }               
            }
        });
    }
}
</code></pre>

<p><em>When i run i'm getting below error</em></p>

<p>SoapFault - faultcode: 'a:DeserializationFailed' faultstring: 'The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter <a href="http://tempuri.org/:user" rel="nofollow">http://tempuri.org/:user</a>. The InnerException message was 'Error in line 1 position 344. Element 'http://tempuri.org/:user' contains data from a type that maps to the name 'http://tempuri.org/:User'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'User' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details.' faultactor: 'null' detail: null</p>

<p>Please help me.it's urgent.</p>

<p>Thanks in advance.</p>
