2 Replies Latest reply on Oct 17, 2007 4:20 PM by Matías Rodriguez

    SessionBean as WebService - again complex data structures

    Carsten Rudat Novice

      Hi all,

      I have a SLSB and want it to be accessable through a webservice. So I write

      package com.genloop.ejb.beans.service;
      import javax.ejb.Remote;
      import javax.jws.WebMethod;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;
      @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
      public interface PartnerWebService extends java.rmi.Remote{
       public String sayHello(String hello);


      package com.genloop.ejb.beans.service;
      import java.util.Date;
      import javax.ejb.Remote;
      import javax.ejb.Stateless;
      import javax.interceptor.Interceptors;
      import javax.jws.WebService;
      import org.jboss.annotation.ejb.RemoteBinding;
      import org.jboss.annotation.security.SecurityDomain;
      import com.genloop.ejb.commons.SecurityInterceptor;
      import com.genloop.ejb.commons.UserInterceptor;
      @Interceptors({UserInterceptor.class, SecurityInterceptor.class})
      @WebService(endpointInterface="com.genloop.ejb.beans.service.PartnerWebService", serviceName="PartnerService")
      public class PartnerWebServiceBean implements PartnerWebService {
       public String sayHello(String hello) {
       return hello;

      My Client works well:

      public class PartnerWSClient {
       * @param args
       public static void main(String[] args) {
       try {
       URL url = new URL(
       QName qname = new QName("http://service.beans.ejb.genloop.com/",
       ServiceFactory factory = ServiceFactory.newInstance();
       Service service = factory.createService(url, qname);
       PartnerWebService partnerService = (PartnerWebService) service
       } catch (MalformedURLException e) {
       } catch (ServiceException e) {

      But now, I add another mehtod:
       public ComplexObject getComplexObject() {
       return new ComplexObject(new Date(), "test");
       public ComplexObject getComplexObject();
      public class ComplexObject implements Serializable {
       private static final long serialVersionUID = 1L;
       protected Date date;
       protected String string;
       public ComplexObject() {

      No, I just get this exception:

      Cannot obtain java/xml type mapping for: {http://service.beans.ejb.genloop.com/}complexObject