3 Replies Latest reply on Jun 15, 2010 11:51 AM by Felipe Jaekel

    Help with remoting

    Felipe Jaekel Newbie

      I was successfully using remoting in a page. Recently I had to use the same page in a another project, so I packed it in a JAR to use it as template. (link)

      After doing that the remoting stub is being generated wrong.

      Right code:

      Seam.Remoting.type.atendimentoBean = function() {
        this.__callback = new Object();
        Seam.Remoting.type.atendimentoBean.prototype.cancelar = function(p0, callback, exceptionHandler) {
          return Seam.Remoting.execute(this, "cancelar", [p0], callback, exceptionHandler);
      Seam.Remoting.type.atendimentoBean.__name = "atendimentoBean";

      Wrong code:

      Seam.Remoting.type.br$com$spdata$persistence$mysql$entity$chat$StAtendente.__name = "br.com.spdata.persistence.mysql.entity.chat.StAtendente";
      Seam.Remoting.type.br$com$spdata$persistence$mysql$entity$chat$StAtendente.__metadata = [
        {field: "id", type: "number"},
        {field: "tipoAtendimento", type: "bean"},
        {field: "produtos", type: "bag"},
        {field: "supervisor", type: "bool"},
        {field: "setorAtendimento", type: "bean"},
        {field: "nome", type: "str"},
        {field: "tecnico", type: "bean"},
        {field: "sistemas", type: "bag"}];
      Seam.Remoting.type.br$com$spdata$persistence$mysql$entity$chat$StMensagemAtendimentoCliente.__name = "br.com.spdata.persistence.mysql.entity.chat.StMensagemAtendimentoCliente";
      Seam.Remoting.type.br$com$spdata$persistence$mysql$entity$chat$StMensagemAtendimentoCliente.__metadata = [
        {field: "id", type: "number"},
        {field: "atendimento", type: "bean"},
        {field: "texto", type: "str"},
        {field: "data", type: "date"}];
      Seam.Remoting.type.atendimentoBean = function() {
        this.finalizado = undefined;
        this.posicaoFila = undefined;
        this.estadoChat = undefined;
        this.atendimento = undefined;
        this.aceitaTermos = undefined;
        this.mensagem = undefined;
        Seam.Remoting.type.atendimentoBean.prototype.isFinalizado = function() { return this.finalizado; }
        Seam.Remoting.type.atendimentoBean.prototype.getPosicaoFila = function() { return this.posicaoFila; }
        Seam.Remoting.type.atendimentoBean.prototype.getEstadoChat = function() { return this.estadoChat; }
        Seam.Remoting.type.atendimentoBean.prototype.getAtendimento = function() { return this.atendimento; }
        Seam.Remoting.type.atendimentoBean.prototype.isAceitaTermos = function() { return this.aceitaTermos; }
        Seam.Remoting.type.atendimentoBean.prototype.getMensagem = function() { return this.mensagem; }
        Seam.Remoting.type.atendimentoBean.prototype.setFinalizado = function(finalizado) { this.finalizado = finalizado; }
        Seam.Remoting.type.atendimentoBean.prototype.setPosicaoFila = function(posicaoFila) { this.posicaoFila = posicaoFila; }
        Seam.Remoting.type.atendimentoBean.prototype.setEstadoChat = function(estadoChat) { this.estadoChat = estadoChat; }
        Seam.Remoting.type.atendimentoBean.prototype.setAtendimento = function(atendimento) { this.atendimento = atendimento; }
        Seam.Remoting.type.atendimentoBean.prototype.setAceitaTermos = function(aceitaTermos) { this.aceitaTermos = aceitaTermos; }
        Seam.Remoting.type.atendimentoBean.prototype.setMensagem = function(mensagem) { this.mensagem = mensagem; }
      Seam.Remoting.type.atendimentoBean.__name = "atendimentoBean";
      Seam.Remoting.type.atendimentoBean.__metadata = [
        {field: "posicaoFila", type: "number"},
        {field: "finalizado", type: "bool"},
        {field: "estadoChat", type: "str"},
        {field: "atendimento", type: "bean"},
        {field: "aceitaTermos", type: "bool"},
        {field: "mensagem", type: "bean"}];

      Any ideas?


        • 2. Re: Help with remoting
          Shane Bryzak Master

          The interface generator generates two types of stubs - action and type stubs.  The first stub that you list is an action stub, and the way that the interface generator detects whether a component is an action component is to scan its declared methods for the @WebRemote annotation.  If it finds one, then it generates an action stub.

          I'm guessing that the issue you have is related to packaging, and that the @WebRemote instance that the interface generator is scanning for is not the same as the one being found on your component class.  How are you packaging your app?  In particular, where are you placing seam-remoting.jar?

          • 3. Re: Help with remoting
            Felipe Jaekel Newbie

            seam-remoting.jar is at WEB-INF/lib, same place from before creating the template.

            I pack my entity classes in a Java SE project, so I add this project to the build path of the Web Projects.

            I moved the common logic of the page to an abstract class inside this Java SE project. The method with @WebRemote was inside this class.

            Removing the annotation and adding it to the classes that inherit from it in the Web Projects solved the problem.

                 public void cancelar(int atendimentoId)

            I had already tested that previously but it didn't worked. Maybe some browser cache issue with the stub.

            Thanks a lot.