6 Replies Latest reply on Mar 8, 2007 9:09 PM by Elmo

    Remoting problem: object as param not passed

    Louis Coetzee Apprentice


      I am playing around with the Seam remoting. I am playing with the helloworld seam application:

      I am attempting to pass a seam object (JavaBean) from the browser to the backend. When invoking the method with the parameter, the method is called, but the object is not populated with any values.

      In short I have the following:
      1. The Javabean:

      public class Person implements Serializable{
       Integer id;
       String name;
       String surname;
      //with getters and setters

      2. The method definition in the interface (HelloLocal):
       public void setPerson(String value, Person person);

      3. The implementation (HelloAction):
      public void setPerson(String value, Person person) {
       System.out.println("Received value: " + value);
       System.out.println("Received from xhtml page " + person.getName() + " " + person.getSurname());

      4. My Javascript being called in the xhtml:
       function sayHello() {
       var p = Seam.Component.newInstance("person");
       Seam.Component.getInstance("helloAction").setPerson("from sayhello", p);

      When I invoke the sayHello javascript I see the following in the debug window:
      Thu Jan 25 2007 13:44:32 GMT+0200 (SAST): Request packet:
      <envelope><header><context></context></header><body><call component="helloAction" method="setPerson" id="1">
      <params><param><str>dummyvalue</str></param><param><ref id="0"/></param></params><refs><ref id="0"><bean type="person">
      <member name="id"><number>15</number></member>
      <member name="name"><str>from</str></member>
      <member name="surname"><str>sayHello</str></member>

      which is the correct values passed to the backend. Unfortunately the person object is not populated, while the string value is sent correctly. The result:
      3:57:37,988 INFO [STDOUT] Received value: from sayhello
      13:57:37,990 INFO [STDOUT] Received from xhtml page null null

      Any suggestions as to why I am not able to send an object as paramter to the server? Interestingly enough I am able to send a person object (created on the backend and returned with "public Person getPerson()" ) to the javascript.