java.lang.RuntimeException: Cannot serialize WebService





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















Hello I have a WebService method with one ArrayList argument, and in Android I have a method to add elements into ArrayList and do the setValue in the PropertyInfo but gives me an exception.



Here is the code of WebService method:



@WebMethod(operationName = "insertar")
public int insertar(@WebParam(name = "IdVideo") ArrayList video) {
int afectados = 0;
try {
String idVideo = video.get(0).toString();
String titulo = video.get(1).toString();
String canal = video.get(2).toString();
int visitas = Integer.parseInt(video.get(3).toString());
String fecha = video.get(4).toString();

Date fechaSubida = new SimpleDateFormat("dd/MM/yyyy").parse(fecha);

DriverManager.registerDriver(new OracleDriver());
Connection cn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:xx:xx", "xxx", "xx");

Statement sentencia = cn.createStatement();
afectados = sentencia.executeUpdate("insert into favoritos values('" + idVideo + "', '" + titulo + "', '" + canal + "', '" + visitas + "', '" + fechaSubida + "')");

if (afectados > 0) {
System.out.println("Dato Insertado");
} else {
System.out.println("No Insertado");
}

return afectados;

} catch (SQLException ex) {
Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
} catch (ParseException ex) {
Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
}
return afectados;
}


And here the code of Andoid method:



public void insertar(View v){
try {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitNetwork().build();

StrictMode.setThreadPolicy(policy);

String resultadoFINAL;
String idVideo = this.etIdVideo.getText().toString();
String titulo = this.etTitulo.getText().toString();
String canal = this.etCanal.getText().toString();
String visitas = this.etVisitas.getText().toString();
String fecha = this.etFecha.getText().toString();

ArrayList<String> listaInsert = new ArrayList();
listaInsert.add(idVideo);
listaInsert.add(titulo);
listaInsert.add(canal);
listaInsert.add(visitas);
listaInsert.add(fecha);

//Creacion de la Solicitud
SoapObject request = new SoapObject(NAMESPACE, METHOD3);
//Creacion del Envelope
SoapSerializationEnvelope sobre = new SoapSerializationEnvelope(SoapEnvelope.VER11);
sobre.setOutputSoapObject(request);
//Creacion del transporte
HttpTransportSE transporte = new HttpTransportSE(URL);

// Paso de parámetro
PropertyInfo dni = new PropertyInfo();
dni.setName("numerodni");
dni.setValue(listaInsert);
request.addProperty(dni);

//Llamada
transporte.call(SOAPACTION3, sobre);

//Resultado
Object resultado = (Object) sobre.getResponse();
resultadoFINAL = resultado.toString();
Toast.makeText(getApplicationContext(), resultadoFINAL, Toast.LENGTH_LONG).show();

}catch (Exception e) {
e.printStackTrace();
}
}


I have the exception in this line transporte.call(SOAPACTION3, sobre);
I think that is a problem with adding an ArrayList like PropertyInfo.



My english is bad, but I hope you can help me, if need more code advice me, thanks!!










share|improve this question































    0















    Hello I have a WebService method with one ArrayList argument, and in Android I have a method to add elements into ArrayList and do the setValue in the PropertyInfo but gives me an exception.



    Here is the code of WebService method:



    @WebMethod(operationName = "insertar")
    public int insertar(@WebParam(name = "IdVideo") ArrayList video) {
    int afectados = 0;
    try {
    String idVideo = video.get(0).toString();
    String titulo = video.get(1).toString();
    String canal = video.get(2).toString();
    int visitas = Integer.parseInt(video.get(3).toString());
    String fecha = video.get(4).toString();

    Date fechaSubida = new SimpleDateFormat("dd/MM/yyyy").parse(fecha);

    DriverManager.registerDriver(new OracleDriver());
    Connection cn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:xx:xx", "xxx", "xx");

    Statement sentencia = cn.createStatement();
    afectados = sentencia.executeUpdate("insert into favoritos values('" + idVideo + "', '" + titulo + "', '" + canal + "', '" + visitas + "', '" + fechaSubida + "')");

    if (afectados > 0) {
    System.out.println("Dato Insertado");
    } else {
    System.out.println("No Insertado");
    }

    return afectados;

    } catch (SQLException ex) {
    Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
    } catch (ParseException ex) {
    Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
    }
    return afectados;
    }


    And here the code of Andoid method:



    public void insertar(View v){
    try {
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitNetwork().build();

    StrictMode.setThreadPolicy(policy);

    String resultadoFINAL;
    String idVideo = this.etIdVideo.getText().toString();
    String titulo = this.etTitulo.getText().toString();
    String canal = this.etCanal.getText().toString();
    String visitas = this.etVisitas.getText().toString();
    String fecha = this.etFecha.getText().toString();

    ArrayList<String> listaInsert = new ArrayList();
    listaInsert.add(idVideo);
    listaInsert.add(titulo);
    listaInsert.add(canal);
    listaInsert.add(visitas);
    listaInsert.add(fecha);

    //Creacion de la Solicitud
    SoapObject request = new SoapObject(NAMESPACE, METHOD3);
    //Creacion del Envelope
    SoapSerializationEnvelope sobre = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    sobre.setOutputSoapObject(request);
    //Creacion del transporte
    HttpTransportSE transporte = new HttpTransportSE(URL);

    // Paso de parámetro
    PropertyInfo dni = new PropertyInfo();
    dni.setName("numerodni");
    dni.setValue(listaInsert);
    request.addProperty(dni);

    //Llamada
    transporte.call(SOAPACTION3, sobre);

    //Resultado
    Object resultado = (Object) sobre.getResponse();
    resultadoFINAL = resultado.toString();
    Toast.makeText(getApplicationContext(), resultadoFINAL, Toast.LENGTH_LONG).show();

    }catch (Exception e) {
    e.printStackTrace();
    }
    }


    I have the exception in this line transporte.call(SOAPACTION3, sobre);
    I think that is a problem with adding an ArrayList like PropertyInfo.



    My english is bad, but I hope you can help me, if need more code advice me, thanks!!










    share|improve this question



























      0












      0








      0








      Hello I have a WebService method with one ArrayList argument, and in Android I have a method to add elements into ArrayList and do the setValue in the PropertyInfo but gives me an exception.



      Here is the code of WebService method:



      @WebMethod(operationName = "insertar")
      public int insertar(@WebParam(name = "IdVideo") ArrayList video) {
      int afectados = 0;
      try {
      String idVideo = video.get(0).toString();
      String titulo = video.get(1).toString();
      String canal = video.get(2).toString();
      int visitas = Integer.parseInt(video.get(3).toString());
      String fecha = video.get(4).toString();

      Date fechaSubida = new SimpleDateFormat("dd/MM/yyyy").parse(fecha);

      DriverManager.registerDriver(new OracleDriver());
      Connection cn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:xx:xx", "xxx", "xx");

      Statement sentencia = cn.createStatement();
      afectados = sentencia.executeUpdate("insert into favoritos values('" + idVideo + "', '" + titulo + "', '" + canal + "', '" + visitas + "', '" + fechaSubida + "')");

      if (afectados > 0) {
      System.out.println("Dato Insertado");
      } else {
      System.out.println("No Insertado");
      }

      return afectados;

      } catch (SQLException ex) {
      Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
      } catch (ParseException ex) {
      Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
      }
      return afectados;
      }


      And here the code of Andoid method:



      public void insertar(View v){
      try {
      StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitNetwork().build();

      StrictMode.setThreadPolicy(policy);

      String resultadoFINAL;
      String idVideo = this.etIdVideo.getText().toString();
      String titulo = this.etTitulo.getText().toString();
      String canal = this.etCanal.getText().toString();
      String visitas = this.etVisitas.getText().toString();
      String fecha = this.etFecha.getText().toString();

      ArrayList<String> listaInsert = new ArrayList();
      listaInsert.add(idVideo);
      listaInsert.add(titulo);
      listaInsert.add(canal);
      listaInsert.add(visitas);
      listaInsert.add(fecha);

      //Creacion de la Solicitud
      SoapObject request = new SoapObject(NAMESPACE, METHOD3);
      //Creacion del Envelope
      SoapSerializationEnvelope sobre = new SoapSerializationEnvelope(SoapEnvelope.VER11);
      sobre.setOutputSoapObject(request);
      //Creacion del transporte
      HttpTransportSE transporte = new HttpTransportSE(URL);

      // Paso de parámetro
      PropertyInfo dni = new PropertyInfo();
      dni.setName("numerodni");
      dni.setValue(listaInsert);
      request.addProperty(dni);

      //Llamada
      transporte.call(SOAPACTION3, sobre);

      //Resultado
      Object resultado = (Object) sobre.getResponse();
      resultadoFINAL = resultado.toString();
      Toast.makeText(getApplicationContext(), resultadoFINAL, Toast.LENGTH_LONG).show();

      }catch (Exception e) {
      e.printStackTrace();
      }
      }


      I have the exception in this line transporte.call(SOAPACTION3, sobre);
      I think that is a problem with adding an ArrayList like PropertyInfo.



      My english is bad, but I hope you can help me, if need more code advice me, thanks!!










      share|improve this question
















      Hello I have a WebService method with one ArrayList argument, and in Android I have a method to add elements into ArrayList and do the setValue in the PropertyInfo but gives me an exception.



      Here is the code of WebService method:



      @WebMethod(operationName = "insertar")
      public int insertar(@WebParam(name = "IdVideo") ArrayList video) {
      int afectados = 0;
      try {
      String idVideo = video.get(0).toString();
      String titulo = video.get(1).toString();
      String canal = video.get(2).toString();
      int visitas = Integer.parseInt(video.get(3).toString());
      String fecha = video.get(4).toString();

      Date fechaSubida = new SimpleDateFormat("dd/MM/yyyy").parse(fecha);

      DriverManager.registerDriver(new OracleDriver());
      Connection cn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:xx:xx", "xxx", "xx");

      Statement sentencia = cn.createStatement();
      afectados = sentencia.executeUpdate("insert into favoritos values('" + idVideo + "', '" + titulo + "', '" + canal + "', '" + visitas + "', '" + fechaSubida + "')");

      if (afectados > 0) {
      System.out.println("Dato Insertado");
      } else {
      System.out.println("No Insertado");
      }

      return afectados;

      } catch (SQLException ex) {
      Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
      } catch (ParseException ex) {
      Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
      }
      return afectados;
      }


      And here the code of Andoid method:



      public void insertar(View v){
      try {
      StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitNetwork().build();

      StrictMode.setThreadPolicy(policy);

      String resultadoFINAL;
      String idVideo = this.etIdVideo.getText().toString();
      String titulo = this.etTitulo.getText().toString();
      String canal = this.etCanal.getText().toString();
      String visitas = this.etVisitas.getText().toString();
      String fecha = this.etFecha.getText().toString();

      ArrayList<String> listaInsert = new ArrayList();
      listaInsert.add(idVideo);
      listaInsert.add(titulo);
      listaInsert.add(canal);
      listaInsert.add(visitas);
      listaInsert.add(fecha);

      //Creacion de la Solicitud
      SoapObject request = new SoapObject(NAMESPACE, METHOD3);
      //Creacion del Envelope
      SoapSerializationEnvelope sobre = new SoapSerializationEnvelope(SoapEnvelope.VER11);
      sobre.setOutputSoapObject(request);
      //Creacion del transporte
      HttpTransportSE transporte = new HttpTransportSE(URL);

      // Paso de parámetro
      PropertyInfo dni = new PropertyInfo();
      dni.setName("numerodni");
      dni.setValue(listaInsert);
      request.addProperty(dni);

      //Llamada
      transporte.call(SOAPACTION3, sobre);

      //Resultado
      Object resultado = (Object) sobre.getResponse();
      resultadoFINAL = resultado.toString();
      Toast.makeText(getApplicationContext(), resultadoFINAL, Toast.LENGTH_LONG).show();

      }catch (Exception e) {
      e.printStackTrace();
      }
      }


      I have the exception in this line transporte.call(SOAPACTION3, sobre);
      I think that is a problem with adding an ArrayList like PropertyInfo.



      My english is bad, but I hope you can help me, if need more code advice me, thanks!!







      java android






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 18:11









      Fantômas

      32.9k156491




      32.9k156491










      asked Nov 23 '18 at 17:26









      BeardmanBeardman

      76




      76
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53450819%2fjava-lang-runtimeexception-cannot-serialize-webservice%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53450819%2fjava-lang-runtimeexception-cannot-serialize-webservice%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Paul Cézanne

          UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

          Angular material date-picker (MatDatepicker) auto completes the date on focus out