开发者

Cannot Serialize error on Android

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 {       
               //开发者_StackOverflowLlamada
               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();
           }

Thanks!!

EDIT: I try this:

request.addProperty("correu", userText.getText().toString());

request.addProperty("pass", passText.getText().toString());

and the exception now is:

org.ksoap2.serialization.SoapPrimitive

EDIT2: It works! I change this:

SoapObject resultado = (SoapObject) sobre.getResponse();

for this:

String resultado = sobre.getResponse().toString();


Try this

 request.addProperty("correu", userText.getText().toString());
 request.addProperty("pass", passText.getText().toString());

Instead of

   request.addProperty("correu", userText.getText());
   request.addProperty("pass", passText.getText());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜