<pre><br><br>workaround: guvnor repository remote commands using http (bypassing gwt interface)<br><br>the commands are passed using serialized java objects.<br><br>IN web.xml:<br><br>   &lt;servlet&gt;<br>      &lt;servlet-name&gt;XptoServlet&lt;/servlet-name&gt;<br>
      &lt;servlet-class&gt;org.jboss.seam.remoting.gwt.AcecServlet&lt;/servlet-class&gt;<br>   &lt;/servlet&gt;<br><br>   &lt;servlet-mapping&gt;<br>      &lt;servlet-name&gt;XptoServlet&lt;/servlet-name&gt;<br>      &lt;url-pattern&gt;/AcecServlet&lt;/url-pattern&gt;<br>
   &lt;/servlet-mapping&gt;<br><br>Servlet code: <br><br>package org.jboss.seam.remoting.gwt;<br>import java.io.IOException;<br>import java.io.ObjectInputStream;<br>import java.io.ObjectOutputStream;<br>import java.io.PrintWriter;<br>
import java.io.Serializable;<br>import java.io.StringWriter;<br>import java.lang.reflect.InvocationTargetException;<br>import java.lang.reflect.Method;<br>import java.util.HashMap;<br>import java.util.Map;<br>import javax.servlet.ServletContext;<br>
import javax.servlet.http.HttpServlet;<br>import javax.servlet.http.HttpServletRequest;<br>import javax.servlet.http.HttpServletResponse;<br>import org.drools.guvnor.client.rpc.DetailedSerializableException;<br>import org.drools.guvnor.client.rpc.RepositoryService;<br>
import org.drools.guvnor.client.rpc.SecurityService;<br>import org.drools.guvnor.client.rpc.SessionExpiredException;<br>import org.jboss.seam.Component;<br>import org.jboss.seam.annotations.remoting.WebRemote;<br>import com.google.gwt.user.client.rpc.SerializationException;<br>
import org.drools.guvnor.server.security.SecurityServiceImpl;<br>/**<br> *<br> * @author Wesley Imamura<br> */<br>public class XptoServlet extends HttpServlet {<br>  private static final String GENERIC_FAILURE_MSG = &quot;An error occurred on the server. Consult server log for details.&quot;;<br>
  private static final HashMap TYPE_NAMES;  <br>  static final Map METHOD_CACHE = new HashMap();<br>  static {<br>       TYPE_NAMES = new HashMap();<br>       TYPE_NAMES.put(&quot;Z&quot;, boolean.class);<br>       TYPE_NAMES.put(&quot;B&quot;, byte.class);<br>
       TYPE_NAMES.put(&quot;C&quot;, char.class);<br>       TYPE_NAMES.put(&quot;D&quot;, double.class);<br>       TYPE_NAMES.put(&quot;F&quot;, float.class);<br>       TYPE_NAMES.put(&quot;I&quot;, int.class);<br>       TYPE_NAMES.put(&quot;J&quot;, long.class);<br>
       TYPE_NAMES.put(&quot;S&quot;, short.class);<br>     }<br>  public final void doPost(HttpServletRequest request, HttpServletResponse response) {<br>   Throwable caught;<br>    try {<br>  <br>       System.out.println(&quot;Reading map.&quot;);<br>
       ObjectInputStream ois = new ObjectInputStream(request.getInputStream());<br>       Map map = (Map) ois.readObject();<br>       ois.close();<br>       System.out.println(&quot;Map read.&quot;);<br>       String methodName = (String) map.get(&quot;methodName&quot;);<br>
       System.out.println(&quot;methodName: &quot; + methodName);<br>       <br>       Integer paramCount = (Integer) map.get(&quot;paramCount&quot;);<br>       System.out.println(&quot;paramCount: &quot; + paramCount.intValue());<br>
       <br>        Class[] paramTypes = new Class[paramCount];<br>        for (int i = 0; i &lt; paramCount; i++) {<br>          String paramClassName = (String) map.get(&quot;param&quot; + i + &quot;Type&quot;);<br>          System.out.println(&quot;paramClassName: &quot; + paramClassName);<br>
          try {<br>            paramTypes[i] = getClassOrPrimitiveFromName(paramClassName);<br>          } catch (ClassNotFoundException e) {<br>            throw new SerializationException(&quot;Unknown parameter &quot; + i + &quot; type &#39;&quot;<br>
                + paramClassName + &quot;&#39;&quot;, e);<br>          }<br>        }<br>        <br>        Object[] args = new Object[paramCount];<br>        for (int i = 0; i &lt; args.length; i++) {<br>          args[i] = map.get(&quot;param&quot; + i + &quot;Value&quot;);<br>
          if (args[i] != null) {<br>             if (args[i].getClass().getName().equals(&quot;java.lang.String&quot;))<br>                System.out.println(&quot;GWTRemoteServiceServlet.processCall(). args[&quot; + i + &quot;]: &quot; + ((String) args[i]));<br>
             else<br>                System.out.println(&quot;GWTRemoteServiceServlet.processCall(). args[&quot; + i + &quot;]: &quot; + args[i].toString());<br>          }<br>        }        <br>        System.out.println(&quot;args ok.&quot;);<br>
        RepositoryService repositoryService = (RepositoryService) Component.getInstance(&quot;org.drools.guvnor.client.rpc.RepositoryService&quot;);<br>        System.out.println(&quot;repositoryService ok.&quot;);<br>        Method method = getMethod( &quot;org.drools.guvnor.client.rpc.RepositoryService&quot;, methodName, repositoryService.getClass(), paramTypes );<br>
        System.out.println(&quot;method ok.&quot;);<br>        try {<br>           SecurityService securityService = new SecurityServiceImpl(); // (SecurityService) Component.getInstance(&quot;org.drools.guvnor.client.rpc.SecurityService&quot;);<br>
           boolean isLogged = securityService.login(&quot;admin&quot;, &quot;password&quot;);<br>           System.out.println(&quot;logged in.&quot;);<br>           <br>           System.out.println(&quot;invoking.&quot;);<br>
           Object result = method.invoke( repositoryService, args );<br>           System.out.println(&quot;invoked.&quot;);<br>           <br>           ReturnedObject returnedObject = new ReturnedObject(method.getReturnType(), result);<br>
           <br>           System.out.println(&quot;writing response.&quot;);<br>           ObjectOutputStream oos = new ObjectOutputStream(response.getOutputStream()); <br>           oos.writeObject(returnedObject);<br>           oos.close();<br>
           System.out.println(&quot;response wrote.&quot;);<br>           <br>        } catch (InvocationTargetException e) {<br>           //now in this case, we log, and then repack it as some sort of a serializable exception<br>
           String exName = e.getCause().getClass().getName();<br>           if (exName.endsWith( &quot;NotLoggedInException&quot; )) {<br>              throw new InvocationTargetException(new SessionExpiredException());<br>
           } else {<br>              Throwable cause = e.getCause();<br>              StringWriter sw = new StringWriter();<br>              PrintWriter w = new PrintWriter(sw);<br>              cause.printStackTrace( w );<br>
              DetailedSerializableException det = new DetailedSerializableException(&quot;An error occurred executing the action.&quot;, sw.toString());<br>              throw new InvocationTargetException(det);<br>           }<br>
        }        <br>        <br>        response.setContentType(&quot;application/binary&quot;);<br>        response.setStatus(HttpServletResponse.SC_OK);<br>        return;<br>    } catch (Throwable e) {<br>       <br>       e.printStackTrace();<br>
       <br>      caught = e;<br>      respondWithFailure(response, caught);<br>    }<br>    <br>  }<br>  /**<br>   * Called when the machinery of this class itself has a problem, rather than<br>   * the invoked third-party method. It writes a simple 500 message back to the<br>
   * client.<br>   */<br>  private void respondWithFailure(HttpServletResponse response, Throwable caught) {<br>    ServletContext servletContext = getServletContext();<br>    servletContext.log(&quot;Exception while dispatching incoming RPC call&quot;, caught);<br>
    try {<br>      response.setContentType(&quot;text/plain&quot;);<br>      response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);<br>      response.getWriter().write(GENERIC_FAILURE_MSG);<br>    } catch (IOException e) {<br>
      servletContext.log(<br>          &quot;sendError() failed while sending the previous failure to the client&quot;,<br>          caught);<br>    }<br>  }<br>  <br>  private Class getClassOrPrimitiveFromName(String name) throws ClassNotFoundException {<br>
     Object value = TYPE_NAMES.get(name);<br>     if (value != null) {<br>        return (Class) value;<br>     }<br>     return getClassFromName(name);<br>  }  <br>  private Class getClassFromName(String name) throws ClassNotFoundException {<br>
       return Class.forName(name, false, this.getClass().getClassLoader());<br>  }<br>  <br>  private Method getMethod(String serviceName, String methodName, Class clz, Class[] paramTypes)  {<br>     String key = getKey( serviceName,  methodName, paramTypes );<br>
     if (METHOD_CACHE.containsKey( key )) {<br>        return (Method) METHOD_CACHE.get( key );<br>     } else {<br>        try {<br>           synchronized ( METHOD_CACHE ) {<br>              Method m = findMethod( clz, methodName, paramTypes );<br>
              if (m == null) throw new NoSuchMethodException();<br>              METHOD_CACHE.put( key, m );<br>              return m;<br>           }<br>        } catch ( NoSuchMethodException e ) {<br>           throw new SecurityException(&quot;Unable to access a service method called [&quot; + methodName + &quot;] on class [&quot; + clz.getName() + &quot;] without the @WebRemote attribute. &quot; +<br>
            &quot;This may be a hack attempt, or someone simply neglected to use the @WebRemote attribute to indicate a method as&quot; +<br>              &quot; remotely accessible.&quot;);<br>        }<br>     }<br>  }<br>
  <br>  private String getKey(String serviceName, String methodName, Class[] paramTypes) {<br>     if (paramTypes == null) {<br>        return serviceName + &quot;.&quot; + methodName;<br>     } else {<br>        String pTypes = &quot;&quot;;<br>
        for ( int i = 0; i &lt; paramTypes.length; i++ ) {<br>           pTypes += paramTypes[i].getName();<br>        }<br>        return serviceName + &quot;.&quot; + methodName + &quot;(&quot; + pTypes + &quot;)&quot;;<br>
     }<br>  }<br>  private Method findMethod(Class clz, String methodName, Class[] paramTypes ) throws NoSuchMethodException {<br>     if (clz == Object.class) {<br>        return null;<br>     } else {<br>        Method m = clz.getMethod( methodName, paramTypes );<br>
        if (isWebRemoteAnnotated( m )) {<br>           return m;<br>        } else {<br>           return findMethod(clz.getSuperclass(), methodName, paramTypes);<br>        }<br>     }<br>  }  <br>  private boolean isWebRemoteAnnotated(Method method) {<br>
      if (method == null) return false;<br>      return method.getAnnotation( WebRemote.class ) != null;<br>  }<br>  public static class ReturnedObject implements Serializable {<br>      public ReturnedObject(Class type,<br>
                            Object result) {<br>          this.returnType = type;<br>          this.returnedObject = result;<br>      }<br>      public Class returnType;<br>      public Object returnedObject;<br>  }<br>}<br>
</pre><br clear="all"><br>-- <br>Wesley Akio Imamura<br>São Paulo - SP - Brazil<br>