I need help. I m trying pass parameters to webservice and it shows me an error: CANNOT SERIALIZE content_of_userText . My code is:
if (button.getId() == R.id.loginButton) {
//Modelo el request
SoapObject request = new SoapObject(namespace, Metodo);
//Paràmetres
request.addProperty("correu", userText.getText());
request.addProperty("pass", passText.getText());
//Modelo el Sobre
SoapSerializationEnvelope sobre = new SoapSerializationEnvelope(SoapEnvelope.VER11);
sobre.dotNet = true;
sobre.setOutputSoapObject(request);
//Modelo el transporte
HttpTransportSE transporte = new HttpTransportSE(url);
try {
//Llamada
transporte.call(accionSoap, sobre);
//Resultado
SoapObject resultado = (SoapObject) sobre.getResponse();
Toast.makeText(this, resultado.toString(), Toast.LENGTH_SHORT).show();
}
catch (Exception e)
{
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
感谢!
EDIT:我尝试:
request.addProperty("correu", userText.getText().toString());
request.addProperty("pass", passText.getText().toString());
目前的例外是:
org.ksoap2.serialization.SoapPrimitive
EDIT2:它发挥作用! 我改变这一点:
SoapObject resultado = (SoapObject) sobre.getResponse();
为此:
String resultado = sobre.getResponse().toString();