Package com.sun.ejb

Examples of com.sun.ejb.Invocation


    public QName[] getHeaders() {
        return new QName[0];
    }

    public boolean handleRequest(MessageContext context) {
        Invocation inv = null;
        Container container = null;

        try {

            Switch theSwitch = Switch.getSwitch();
            InvocationManager invManager = theSwitch.getInvocationManager();
            inv = (Invocation) invManager.getCurrentInvocation();
            container = (Container) inv.container;

            inv.method = wsUtil.getInvMethod(inv.getWebServiceTie(), context);

            // Result can be null for some error cases.  This will be
            // handled by jaxrpc runtime so we don't treat it as an exception.
            if( inv.method != null ) {
                inv.setWebServiceMethod(inv.method);
              
                if ( !container.authorize(inv) ) {
                    inv.exception = new Exception
                        ("Client not authorized for invocation of "
                         + inv.method);
                }
            } else {
                inv.setWebServiceMethod(null);
            }
        } catch(Exception e) {
            String errorMsg = "Error unmarshalling method " +
                ( (container != null ) ?
                  "for ejb " + container.getEjbDescriptor().getName() :
View Full Code Here


    public QName[] getHeaders() {
        return new QName[0];
    }

    public boolean handleRequest(MessageContext context) {
        Invocation inv = null;
        boolean continueProcessing = true;

        try {
            Switch theSwitch = Switch.getSwitch();
            InvocationManager invManager = theSwitch.getInvocationManager();
            inv = (Invocation) invManager.getCurrentInvocation();
            Container container = (Container) inv.container;

            Method webServiceMethodInPreHandler = inv.getWebServiceMethod();

            if( webServiceMethodInPreHandler != null ) {
                // Now that application handlers have run, do another method
                // lookup and compare the results with the original one.  This
                // ensures that the application handlers have not changed
                // the message context in any way that would impact which
                // method is invoked.
                Method postHandlerMethod =
                    wsUtil.getInvMethod(inv.getWebServiceTie(), context);
                if( !webServiceMethodInPreHandler.equals(postHandlerMethod) ) {
                    inv.exception = new UnmarshalException
                        ("Original method " + webServiceMethodInPreHandler +
                         " does not match post-handler method " +
                         postHandlerMethod);
View Full Code Here

  // and move the endpoint specific check down stream
  if (isEjbEndpoint) {

      Switch theSwitch = Switch.getSwitch();
      InvocationManager invManager= theSwitch.getInvocationManager();
      Invocation inv= (Invocation) invManager.getCurrentInvocation();
            // one need to copy message here, otherwise the message may be
            // consumed
            inv.setMessage(request.getMessage().copy());
      Exception ie = null;
            Method m = null;
            if (seiModel != null) {
          JavaMethod jm = request.getMessage().getMethod(seiModel);
          m = (jm != null) ? jm.getMethod() : null;
            } else { // WebServiceProvider
               WebServiceEndpoint endpoint = (WebServiceEndpoint)
                   map.get(PipeConstants.SERVICE_ENDPOINT);
               EjbDescriptor ejbDescriptor = endpoint.getEjbComponentImpl();
               if (ejbDescriptor != null) {
                   final String ejbImplClassName = ejbDescriptor.getEjbImplClassName();
                   if (ejbImplClassName != null) {
                       try {
                           m = (Method)AppservAccessController.doPrivileged
                               ( new PrivilegedExceptionAction() {
                                   public Object run() throws Exception {
                                       ClassLoader loader =
                                           Thread.currentThread().getContextClassLoader();
                                       Class clazz =
                                           Class.forName(ejbImplClassName, true, loader);
                                       return clazz.getMethod("invoke",
                                               new Class[] { Object.class });
                                  }
                           });
                       } catch(PrivilegedActionException pae) {
                           throw new RuntimeException(pae.getException());
                       }
                   }
               }

            }
     
      if (m != null) {

    Container container = (Container) inv.container;

    try {
        inv.method = m;
        if ( !container.authorize(inv) ) {

      ie = new Exception
          (localStrings.getLocalString
           ("enterprise.webservice.methodNotAuth",
            "Client not authorized for invocation of {0}",
            new Object[] { inv.method }) );
        } else {
      // Record the method on which the successful
      // authorization check was performed.
      inv.setWebServiceMethod(inv.method);
        }
    } catch(Exception e) {
        String errorMsg = localStrings.getLocalString
      ( "enterprise.webservice.errorUnMarshalMethod",
        "Error unmarshalling method for ejb {0}",
        new Object[] { ejbName() });
        ie = new UnmarshalException(errorMsg);
        ie.initCause(e);
    }
   
    if ( ie != null ) {
        inv.exception = ie;
        throw ie;
    }

      } else {
    inv.setWebServiceMethod(null);
      }
  }
           
  return;
    }
View Full Code Here

TOP

Related Classes of com.sun.ejb.Invocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.