  public static class AxisDispatcher extends RPCProvider {
    
    
    public void processMessage(MessageContext msgContext, String serviceName, String allowedMethods, SOAPEnvelope reqEnv, SOAPEnvelope resEnv, JavaClass jc, Object obj) throws Exception {
      P2plusThread p2plusThread;
      Socket clientSocket;
      String callerName;
      String packageName, className, completeName;
      Class objClass;
      
      packageName = (String)msgContext.getProperty("packagename");
      className = (String)msgContext.getProperty("classname");
      completeName = BaseObject.PACKAGE_NAME + "." + packageName + "." + className;
      
      callerName = (String)msgContext.getProperty("callername");
      clientSocket = (Socket)msgContext.getProperty("clientsocket");
      
      p2plusThread = (P2plusThread)Thread.currentThread();
      p2plusThread.setCallerName(callerName);
      p2plusThread.setUserName(UserNameMapper.getUserName(callerName));
      p2plusThread.setCallerAddress(clientSocket.getInetAddress());
      
      try {
        objClass = Class.forName(completeName);
      } catch(ClassNotFoundException cnfe) {
        throw new P2IllegalException("C_CLASSDOESNOTEXIST|" + completeName);
      }

      obj = objClass.newInstance();
      
      try {
        super.processMessage(msgContext, serviceName, allowedMethods, reqEnv, resEnv, jc, obj);
      } finally {
        Transaction.cleanup(completeName, (String)msgContext.getProperty("methodname"));
      }
      return;
    } // processMessage
    
    
    protected Method[] getMethod(MessageContext msgContext, JavaClass jc, String mName) throws Exception {
      HashMap allMethods;
      Method[] methods;
      MethodInfo methodInfo;
      String packageName, className, completeName, callerName;
      
      msgContext.setProperty("methodname", mName);
      
      callerName = (String)msgContext.getProperty("callername");
      packageName = (String)msgContext.getProperty("packagename");
      className = (String)msgContext.getProperty("classname");
      completeName = BaseObject.PACKAGE_NAME + "." + packageName + "." + className;
      methods = new Method[1];
      allMethods = getMethods(packageName, className);
      methodInfo = (MethodInfo)allMethods.get(mName);

      if(methodInfo == null)
        throw new P2IllegalException("C_CLASSHASNOMETHOD|" + completeName + "|" + mName);
      
      methods[0] = methodInfo.method;
      
      if(! P2plusServer.checkAccess(P2plusServer.getCallerName(), packageName, className, mName))
        throw new P2IllegalException("C_ACCESSDENIED");
      
      return(methods);
    } // getMethod
    
    
    protected void checkMethodName(MessageContext msgContext, String allowedMethods, String mName) throws Exception {
      return;
    }
    
    
    protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
      StringWriter sw;
      Object objRes;
      String packageName, className, completeName;
      
      packageName = (String)msgContext.getProperty("packagename");
      className = (String)msgContext.getProperty("classname");
      completeName = BaseObject.PACKAGE_NAME + "." + packageName + "." + className;
      
      try {
        objRes = method.invoke(obj, argValues);
      } catch(IllegalArgumentException iae) {
        throw iae;
        
      } catch(InvocationTargetException ite) {
        // ite.printStackTrace();
        if(ite.getTargetException() instanceof RuntimeException) {
          ite.getTargetException().printStackTrace();
          sw = new StringWriter();
          ite.getTargetException().printStackTrace(new PrintWriter(sw));
          new EventLog().writeWarning("AppServer error:\n" + sw.toString(),
          EventLog.EVENTLOG_CAT_APPLICATION_SERVER, EVENTLOG_ID_ERROR);
          if(ite.getTargetException().getMessage() == null)
            throw new P2ProblemException("Null-Pointer!");
          else
            throw (RuntimeException)ite.getTargetException();
        } else {
          if(ite.getTargetException() instanceof Exception)
            throw (Exception)ite.getTargetException();
          else
            throw ite;
        }
        
      } catch(NullPointerException ne) {
        ne.printStackTrace();
        sw = new StringWriter();
        ne.printStackTrace(new PrintWriter(sw));
        new EventLog().writeWarning("AppServer error:\n" + sw.toString(),
        EventLog.EVENTLOG_CAT_APPLICATION_SERVER, EVENTLOG_ID_ERROR);
        throw new P2ProblemException("Null-Pointer!");
        
      } catch(Throwable t) {
        throw new P2ProblemException(t.getMessage());
      }
      return(objRes);
    } // invokeMethod
  } // AxisDispatcher

