0 Replies Latest reply on Nov 12, 2007 10:00 AM by burakbayramli

    Returning lists on jbossws-1.2.1.GA

    burakbayramli Newbie

      Hi all,

      How can we return lists using @WebMethod, @WebService annotations

      I have used the following code but I received the error below:

      Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://service.gg.com/}arrayList
       at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.buildOutputParameter(JAXRPCMetaDataBuilder.java:346)
       at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.buildParameterMetaDataRpc(JAXRPCMetaDataBuilder.java:592)
       at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.setupOperationsFromWSDL(JAXRPCMetaDataBuilder.java:210)
       at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaDataInternal(JAXRPCClientMetaDataBuilder.java:216)
       at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:133)
       at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:85)
       at org.jboss.ws.core.jaxrpc.client.ServiceImpl.<init>(ServiceImpl.java:111)
       at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
       at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:128)
       at com.gg.service.Client.main(Client.java:21)
      


      Code:



      @WebService
      @SOAPBinding(style=Style.RPC)
      public interface ProductDb extends Remote {
      
       @WebMethod ArrayList<Product> getProducts();
      
      }
      


      @Stateless
      @WebService(endpointInterface="com.gg.service.ProductDb")
      @WebContext(contextRoot="/ggServices")
      public class ProductDbBean {
      
       @PersistenceContext(unitName="GGLocal")
       EntityManager em;
      
       public ArrayList<Product> getProducts() {
       List<Product> l = em.createQuery("from Product").getResultList();
       ArrayList<Product> list = new ArrayList<Product>();
       for (Product p : l) {
       list.add(p);
       }
       return list;
       }
      
      
      }
      
      




      public class Client
      {
       public static void main(String[] args) throws Exception
       {
       URL url = new URL("http://localhost:8080/ggServices/ProductDbBean?wsdl");
       QName qname = new QName("http://service.gg.com/",
       "ProductDbBeanService");
      
       ServiceFactory factory = ServiceFactory.newInstance();
       Service service = factory.createService(url, qname);
       ProductDb s = (ProductDb) service.getPort(ProductDb.class);
      
       ArrayList<Product> list = s.getProducts();
      
       }
      


      Thanks in advance,