0 Replies Latest reply on Mar 12, 2007 1:07 AM by Devon Hillard

    Seam and Web Services

    Devon Hillard Novice

      I was trying to expose some methods on a Seam component as web services using the @WebMethod annotations as per the JBoss WS documentation. It almost worked, except that the web service called a non-instantiated class, so all the seam stuff didn't work. Which makes sense. (It's my first time making a web service).

      At any rate, I then tried using the following code:

      Class[] args1 = new Class[2];
       args1[0] = String.class;
       args1[1] = String.class;
       String[] zipsArray = new String[2];
       zipsArray[0] = pZip1;
       zipsArray[1] = pZip2;
       Component comp = Seam.componentForName("carbonCalculator");
       Double cost = 0.0;
       try {
       cost = (Double) comp.callComponentMethod(comp, CarbonCalculator.class.getMethod("calculateCost", args1),
       (Object[]) zipsArray);
       } catch (SecurityException e) {
       // TODO Auto-generated catch block
       } catch (NoSuchMethodException e) {
       // TODO Auto-generated catch block
       return cost;

      I kept getting a no such method error. The method exists on the seam component.

      Anyway, I didn't know if there were any examples or documentation or approaches for exposing seam component's as web services? For the time being I have a non-seam copy of the code to support the web service, but that's clearly a bad approach.