/** * Returns WebServiceContext associated with this invocation. * * @param invocation current invocation * @return web service context or null if not available */ private WebServiceContext getWebServiceContext(final Invocation invocation) { final InvocationContext invocationContext = invocation.getInvocationContext(); return invocationContext.getAttachment(WebServiceContext.class); }
/** * Creates invocation. * * @return invocation instance */ public final Invocation createInvocation() { return new Invocation(); }
public void invoke(Endpoint ep, Invocation epInv) throws Exception { log.debug("Invoke: " + epInv.getJavaMethod().getName()); try { InvocationContext invContext = epInv.getInvocationContext(); Object targetBean = invContext.getTargetBean(); Class implClass = targetBean.getClass(); Method seiMethod = epInv.getJavaMethod(); Method implMethod = getImplMethod(implClass, seiMethod); Object[] args = epInv.getArgs(); Object retObj = implMethod.invoke(targetBean, args); epInv.setReturnValue(retObj); } catch (Exception e) { handleInvocationException(e); } } }
public void invoke(Endpoint ep, Invocation wsInv) throws Exception { try { ServiceEndpointContainer invocationTarget = lazyInitializeInvocationTarget(); Class beanClass = invocationTarget.getServiceImplementationClass(); Method method = getImplMethod(beanClass, wsInv.getJavaMethod()); Object[] args = wsInv.getArgs(); InvocationContextCallback invProps = new EJB3InvocationContextCallback(wsInv); Object retObj = invocationTarget.invokeEndpoint(method, args, invProps); wsInv.setReturnValue(retObj); } catch (Throwable th) { handleInvocationException(th); } }
final Object[] reqParams = wsInvocation.getArgs(); context.setParameters(reqParams); final Object resObj = context.proceed(); wsInvocation.setReturnValue(resObj); return wsInvocation.getReturnValue();
private org.jboss.invocation.Invocation getMBeanInvocation(Invocation inv) { // EJB2.1 endpoints will only get an JAXRPC context MessageContext msgContext = inv.getInvocationContext().getAttachment(MessageContext.class); if (msgContext == null) throw new IllegalStateException("Cannot obtain MessageContext"); SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter(); Principal principal = securityAdaptor.getPrincipal(); Object credential = securityAdaptor.getCredential(); Method method = inv.getJavaMethod(); Object[] args = inv.getArgs(); org.jboss.invocation.Invocation jbInv = new org.jboss.invocation.Invocation(null, method, args, null, principal, credential); HandlerCallback callback = inv.getInvocationContext().getAttachment(HandlerCallback.class); if (callback == null) throw new IllegalStateException("Cannot obtain HandlerCallback"); jbInv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext); jbInv.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext)msgContext).getMessage()); jbInv.setType(InvocationType.SERVICE_ENDPOINT); jbInv.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT); jbInv.setValue(Invocation.class.getName(), inv, PayloadKey.TRANSIENT); return jbInv; } }
public void invoke(Endpoint ep, Invocation inv) throws Exception { log.debug("Invoke: " + inv.getJavaMethod().getName()); // invoke on the container try { // setup the invocation org.jboss.invocation.Invocation jbInv = getMBeanInvocation(inv); String[] sig = { org.jboss.invocation.Invocation.class.getName() }; Object retObj = server.invoke(objectName, "invoke", new Object[] { jbInv }, sig); inv.setReturnValue(retObj); } catch (Exception e) { handleInvocationException(e); } }
/** * This overrides org.apache.cxf.jaxws.AbstractInvoker in order for using the JBossWS integration logic * to invoke the JBoss AS target bean. */ @Override protected Object performInvocation(Exchange exchange, final Object serviceObject, Method m, Object[] paramArray) throws Exception { Endpoint ep = exchange.get(Endpoint.class); final InvocationHandler invHandler = ep.getInvocationHandler(); final Invocation inv = createInvocation(invHandler, serviceObject, ep, m, paramArray); if (factory != null) { inv.getInvocationContext().setProperty("forceTargetBean", true); } Bus threadBus = BusFactory.getThreadDefaultBus(false); BusFactory.setThreadDefaultBus(disableDepUserDefThreadBus ? null : ep.getAttachment(Bus.class)); setNamespaceContextSelector(exchange); ClassLoader cl = SecurityActions.getContextClassLoader(); SecurityActions.setContextClassLoader(serviceObject.getClass().getClassLoader()); try { invHandler.invoke(ep, inv); return inv.getReturnValue(); } finally { SecurityActions.setContextClassLoader(cl); //make sure the right bus is restored after coming back from the endpoint method BusFactory.setThreadDefaultBus(threadBus); clearNamespaceContextSelector(exchange); } }
private Invocation createInvocation(InvocationHandler invHandler, Object serviceObject, Endpoint ep, Method m, Object[] paramArray) { Invocation inv = invHandler.createInvocation(); InvocationContext invContext = inv.getInvocationContext(); WebServiceContext wsCtx = new WebServiceContextImpl(null); invContext.addAttachment(WebServiceContext.class, wsCtx); invContext.setTargetBean(serviceObject); inv.setJavaMethod(m); inv.setArgs(paramArray); return inv; }
public void invoke(Endpoint ep, Invocation epInv) throws Exception { try { Object targetBean = getTargetBean(ep, epInv); InvocationContext invContext = epInv.getInvocationContext(); WebServiceContext wsContext = invContext.getAttachment(WebServiceContext.class); if (wsContext != null) { ResourceInjector injector = resourceInjectorFactory.newResourceInjector(); injector.inject(targetBean, wsContext); } Method method = getImplMethod(targetBean.getClass(), epInv.getJavaMethod()); Object retObj = method.invoke(targetBean, epInv.getArgs()); epInv.setReturnValue(retObj); } catch (Exception e) { handleInvocationException(e); } }
public void invoke(Endpoint ep, Invocation wsInv) throws Exception { try { ServiceEndpointContainer invocationTarget = lazyInitializeInvocationTarget(); Class beanClass = invocationTarget.getServiceImplementationClass(); Method method = getImplMethod(beanClass, wsInv.getJavaMethod()); Object[] args = wsInv.getArgs(); InvocationContextCallback invProps = new EJB3InvocationContextCallback(wsInv); Object retObj = invocationTarget.invokeEndpoint(method, args, invProps); wsInv.setReturnValue(retObj); } catch (Throwable th) { handleInvocationException(th); } }
final Object[] reqParams = wsInvocation.getArgs(); jbossInvocation.setArguments(reqParams); final Object resObj = this.getNext().invoke(jbossInvocation); wsInvocation.setReturnValue(resObj); return wsInvocation.getReturnValue();
private org.jboss.invocation.Invocation getMBeanInvocation(Invocation inv) { // EJB2.1 endpoints will only get an JAXRPC context MessageContext msgContext = inv.getInvocationContext().getAttachment(MessageContext.class); if (msgContext == null) throw new IllegalStateException("Cannot obtain MessageContext"); SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter(); Principal principal = securityAdaptor.getPrincipal(); Object credential = securityAdaptor.getCredential(); Method method = inv.getJavaMethod(); Object[] args = inv.getArgs(); org.jboss.invocation.Invocation jbInv = new org.jboss.invocation.Invocation(null, method, args, null, principal, credential); HandlerCallback callback = inv.getInvocationContext().getAttachment(HandlerCallback.class); if (callback == null) throw new IllegalStateException("Cannot obtain HandlerCallback"); jbInv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext); jbInv.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext)msgContext).getMessage()); jbInv.setType(InvocationType.SERVICE_ENDPOINT); jbInv.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT); jbInv.setValue(Invocation.class.getName(), inv, PayloadKey.TRANSIENT); return jbInv; } }
public void invoke(Endpoint ep, Invocation inv) throws Exception { log.debug("Invoke: " + inv.getJavaMethod().getName()); // invoke on the container try { // setup the invocation org.jboss.invocation.Invocation jbInv = getMBeanInvocation(inv); String[] sig = { org.jboss.invocation.Invocation.class.getName() }; Object retObj = server.invoke(objectName, "invoke", new Object[] { jbInv }, sig); inv.setReturnValue(retObj); } catch (Exception e) { handleInvocationException(e); } }
public void invoke(Endpoint ep, Invocation epInv) throws Exception { try { Object targetBean = getTargetBean(ep, epInv); InvocationContext invContext = epInv.getInvocationContext(); WebServiceContext wsContext = invContext.getAttachment(WebServiceContext.class); if (wsContext != null) { ResourceInjector injector = resourceInjectorFactory.newResourceInjector(); injector.inject(targetBean, wsContext); } Method method = getImplMethod(targetBean.getClass(), epInv.getJavaMethod()); Object retObj = method.invoke(targetBean, epInv.getArgs()); epInv.setReturnValue(retObj); } catch (Exception e) { handleInvocationException(e); } }
public void invoke(Endpoint ep, Invocation wsInv) throws Exception { try { ServiceEndpointContainer invocationTarget = lazyInitializeInvocationTarget(); Class beanClass = invocationTarget.getServiceImplementationClass(); Method method = getImplMethod(beanClass, wsInv.getJavaMethod()); Object[] args = wsInv.getArgs(); InvocationContextCallback invProps = new EJB3InvocationContextCallback(wsInv); Object retObj = invocationTarget.invokeEndpoint(method, args, invProps); wsInv.setReturnValue(retObj); } catch (Throwable th) { handleInvocationException(th); } }
final Object[] reqParams = wsInvocation.getArgs(); jbossInvocation.setArguments(reqParams); final Object resObj = this.getNext().invoke(jbossInvocation); wsInvocation.setReturnValue(resObj); return wsInvocation.getReturnValue();
private org.jboss.invocation.Invocation getMBeanInvocation(Invocation inv) { // EJB2.1 endpoints will only get an JAXRPC context MessageContext msgContext = inv.getInvocationContext().getAttachment(MessageContext.class); if (msgContext == null) throw new IllegalStateException("Cannot obtain MessageContext"); SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter(); Principal principal = securityAdaptor.getPrincipal(); Object credential = securityAdaptor.getCredential(); Method method = inv.getJavaMethod(); Object[] args = inv.getArgs(); org.jboss.invocation.Invocation jbInv = new org.jboss.invocation.Invocation(null, method, args, null, principal, credential); HandlerCallback callback = inv.getInvocationContext().getAttachment(HandlerCallback.class); if (callback == null) throw new IllegalStateException("Cannot obtain HandlerCallback"); jbInv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext); jbInv.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext)msgContext).getMessage()); jbInv.setType(InvocationType.SERVICE_ENDPOINT); jbInv.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT); jbInv.setValue(Invocation.class.getName(), inv, PayloadKey.TRANSIENT); return jbInv; } }
public void invoke(Endpoint ep, Invocation inv) throws Exception { log.debug("Invoke: " + inv.getJavaMethod().getName()); // invoke on the container try { // setup the invocation org.jboss.invocation.Invocation jbInv = getMBeanInvocation(inv); String[] sig = { org.jboss.invocation.Invocation.class.getName() }; Object retObj = server.invoke(objectName, "invoke", new Object[] { jbInv }, sig); inv.setReturnValue(retObj); } catch (Exception e) { handleInvocationException(e); } }
/** * Returns endpoint instance associated with current invocation. * * @param invocation current invocation * @return target bean in invocation */ private Object getTargetBean(final Invocation invocation) { final InvocationContext invocationContext = invocation.getInvocationContext(); return invocationContext.getTargetBean(); }