I have a login view, from the view, when user types username, password, I need to send them to a webservice. The service will then validate the credentials and return an ID.(customerid).

The service needs to be sent an object of 'Credential' class.

The class:
public class Credetials {

private String username;
private String password;


public Credetials(){}

public String getUserName(){
return this.username;
}
public void setUserName(String uname){
this.username=uname;
}

public String getPassword(){
return this.password;
}
public void setPassword(String password){
this.password=password;
}


}

The view/activity:

loginButton.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

/* reading username and password*/
String username=loginname.getText().toString();
String password=logincode.getText().toString();

Credetials credentials=new Credetials();
credentials.setUserName(username);
credentials.setPassword(password);

Log.d("username", credentials.getUserName());
Log.d("password", credentials.getPassword());
**// here i have proper username and password.**

new callGetCustomerId().execute(credentials);


}
});
class callGetCustomerId extends AsyncTask<Object, Void, String>{
@Override
protected String doInBackground(Object... params) {

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("credentials", params[0]);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

try{
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject response = (SoapObject) envelope.getResponse();

return response.toString();


}catch(Exception e){
return e.getMessage();
}

}
@Override
protected void onPostExecute(String result){
super.onPostExecute(result);
Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();

}
}


web service:

<xs:complexType name="getCustomerId">
<xs:sequence>
<xs:element name="credetials" type="tns:credentials" minOccurs="0"/>
</xs:sequence>

Problem:

Now the problem is it always goes to the catch block. The error is shows somehting like "Cannot serialize: blah blah..Credentials@413...." Can anybody help me out with what am I doing wrong. ??

I have sent single string parameter before which works fine...so I believe my way of sending 'credential' object may be wrong..!!