0 Replies Latest reply on Jul 11, 2008 11:41 AM by pdelgallego

    question about Seam and WS.

    pdelgallego

      Hi all.


      Im new with WS. I want to pass a list of objects from the server to the client. The server run on Seam and the client is a Swing application. But I think I have some conceptual problems about WS. Anyone knows a good tutorial about Seam and WS?. My WS is register in the JBossWS/Services panel. This is what Im doing :


      In the server side I wrote the local interface :


      @Local
      public interface DriveService extends Remote
      {
              public List<Vehicle> performOperation(String driveIdentifier, int queryQuantity); 
      }




      Also, I wrote a service that implements the local interface :


      interface Vehicle{
              public void run ();
      }
      
      class Car implements Vehicle {
              public void run() {;}   
      }
      
      class Bike implements Vehicle {
              public void run() {;}   
      }
      
      @Name("ws.driveService")
      @Stateless
      @WebService
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public class DriveServiceBean implements DriveService
      {  
              @In EntityManager entityManager;
                
              @WebMethod
              public List<Vehicle> performOperation(String driveIdentifier, int queryQuantity)
              { 
                      List<Vehicle> list = new ArrayList<Vehicle>();
                      list.add(new Car());
                      list.add(new Bike());
                      list.add(new Bike());
                      list.add(new Car());
                      return list;
              } 
      }



      In the client, I have a facade like this. 


      @WebService(name = "DriveServiceBean", targetNamespace = "....")
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public interface DriveServiceBean { 
          /**
           * 
           * @param arg1
           * @param arg0
           * @return
           *     returns java.lang.Object
           */
          @WebMethod
          @WebResult(partName = "return")
          public Object performOperation(
              @WebParam(name = "arg0", partName = "arg0")
              String arg0,
              @WebParam(name = "arg1", partName = "arg1")
              int arg1);
      
      }




      and a simple client :



      public class ClientApplication
      {  
              private static Logger logger = Logger.getLogger(ClientConfiguration.class.getName());  
              
              public static void main(String args[])
              {
                      // Setup the driverService and get the 
                      DriveServiceBean driveService = (DriveServiceBean) new DriveServiceBeanService().getDriveServiceBeanPort();
                      Object list = driveService.performOperation(ClientApplication.getDriveIdentifier(5), queryQuantity);
      
                      System.out.println(list.getClass());
                      System.out.println(list.toString());
              }
              
              private static String getDriveIdentifier(int index)
              {
                      String identifier = driveIdentifierPrefix + (10000 + index);
                      return identifier;
              } 
       
      }



      The output for this program is :


      run:
           [java] class org.apache.xerces.dom.ElementNSImpl
           [java] [return: null]





      Thanx for your time