0 Replies Latest reply on Aug 16, 2002 3:22 PM by Mark Lui

    Problems passing JavaBean Object to EJB

    Mark Lui Newbie

      I have been having problems passing a serializable JavaBean object as an argument to an EJB exposed as a web service using JBoss.net. However, returning a JavaBean object works just fine. It returns the following error:

      org.xml.sax.SAXException: SimpleDeser cannot handle structured data!

      The odd thing is I have tried this using just Axis running on Tomcat and it work just find. I have tried creating a simple Java class deploy as a web service in JBoss and I can pass the same JavaBean with no problem. But when I attempt to pass the Bean class to an EJB, I get this error.

      I am using the version of JBoss.net bundled with JBoss 3.0.0. I am not sure if this is a bug or I am doing something wrong.

      The bean classes is registered in the web-service.xml file as:



      And the client code looks like this:

      String endpoint = "http://localhost:8080/axis/services/CustomerBO";
      String methodName = "test";

      Service service = new Service();
      Call call = (Call) service.createCall();
      QName qn = new QName( "CustomerData" );

      call.registerTypeMapping(CustomerData.class, qn,
      new org.apache.axis.encoding.ser.BeanSerializerFactory(CustomerData.class, qn),
      new org.apache.axis.encoding.ser.BeanDeserializerFactory(CustomerData.class, qn));

      call.setTargetEndpointAddress( new java.net.URL(endpoint) );
      call.setOperationName(methodName);

      // Call to addParameter/setReturnType as described in user-guide.html
      call.addParameter("arg0",
      qn,
      ParameterMode.PARAM_MODE_IN);
      call.setReturnType(XMLType.XSD_STRING);

      CustomerData data = new CustomerData();
      data.setCustomerId(new Integer(1));
      data.setEmail("firstname.lastname@yahoo.com");
      data.setFirstName("firstname");
      data.setLastName("lastname");

      String ret = (String)call.invoke( new Object[] { data } );

      System.out.println(ret);
      }
      catch (Exception e)
      {
      System.err.println(e.toString());
      }

      Any help or insight would be appreciated.

      Mark