1 Reply Latest reply on Jun 27, 2008 7:30 AM by anoweb

    Object sent using WebService has null value

    anoweb
      I have a webservice running in JBoss. It simply has a "getperson" and "addperson" methods. getPerson takes an int and returns a Person (java) object. My flex code is fine with that. Then when I try to call the "addPerson" method of the webservice (from flex) the Java code that gets called seems to only be partially populated. For example:

      Flex:
      var p : Object = new Object();
      p.firstName = textFirst.text;
      p.lastName = textLast.text;

      var ws : WebService = new WebService();
      ws.wsdl = " http://localhost:8080/MyWebProject/person?wsdl";
      ws.addPerson.addEventListener("result", handleResult_addPerson);
      ws.addEventListener(FaultEvent.FAULT, handleFault);
      ws.loadWSDL();
      ws.addPerson(p);

      Say the textFirst and textLast have "Bill" and "Gates".

      Java:
      // the web service method implementation
      public int addPerson(Person person) {
      System.out.println("Person being added: " + person);
      if (person != null) {
      System.out.println("first: " + person.getFirstName());
      System.out.println("last: " + person.getLastName());
      }
      }

      The output in the JBoss console when "addPerson" is invoked is:
      Person: Person@40280923 (something like that)
      first: Bill
      last: null

      Any ideas why???