[jboss-user] [JBossWS] - Returning lists on jbossws-1.2.1.GA

burakbayramli do-not-reply at jboss.com
Mon Nov 12 10:01:01 EST 2007


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, 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103714#4103714

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4103714



More information about the jboss-user mailing list