@Override public void customize(Object beanInstance) { if (beanInstance instanceof EndpointImpl) { configureEndpoint((EndpointImpl) beanInstance); } if (beanInstance instanceof ServerFactoryBean) { ServerFactoryBean factory = (ServerFactoryBean) beanInstance; if (factory.getInvoker() instanceof JBossWSInvoker) { ((JBossWSInvoker) factory.getInvoker()).setTargetBean(factory.getServiceBean()); } List<Endpoint> depEndpoints = dep.getService().getEndpoints(); if (depEndpoints != null) { final String targetBeanName = factory.getServiceBean().getClass().getName(); for (Endpoint depEndpoint : depEndpoints) { if (depEndpoint.getTargetBeanClass().getName().equals(targetBeanName)) { depEndpoint.addAttachment(Object.class, factory.getServiceBean()); } } } } if (beanInstance instanceof ServiceImpl) { ServiceImpl service = (ServiceImpl) beanInstance; List<Endpoint> depEndpoints = dep.getService().getEndpoints(); if (depEndpoints != null) { final Collection<org.apache.cxf.endpoint.Endpoint> eps = service.getEndpoints().values(); for (Endpoint depEp : depEndpoints) { for (org.apache.cxf.endpoint.Endpoint ep : eps) { if (ep.getService().getName().equals(depEp.getProperty(Message.WSDL_SERVICE)) && ep.getEndpointInfo().getName().equals(depEp.getProperty(Message.WSDL_PORT))) { depEp.addAttachment(org.apache.cxf.endpoint.Endpoint.class, ep); } } } } } if (beanInstance instanceof HTTPTransportFactory) { HTTPTransportFactory factory = (HTTPTransportFactory) beanInstance; DestinationRegistry oldRegistry = factory.getRegistry(); if (!(oldRegistry instanceof JBossWSDestinationRegistryImpl)) { factory.setRegistry(new JBossWSDestinationRegistryImpl()); } } super.customize(beanInstance); }
/** * Invokes WS endpoint. * * @param endpoint WS endpoint * @param wsInvocation web service invocation * @throws Exception if any error occurs */ public void invoke(final Endpoint endpoint, final Invocation wsInvocation) throws Exception { try { // prepare for invocation onBeforeInvocation(wsInvocation); // prepare invocation data final ComponentView componentView = getComponentView(); Component component = componentView.getComponent(); // for spring integration and @FactoryType is annotated we don't need to go into ee's // interceptors if (wsInvocation.getInvocationContext().getTargetBean() != null && (endpoint.getProperty("SpringBus") != null) || wsInvocation.getInvocationContext().getProperty("forceTargetBean") != null) { this.reference = new ManagedReference() { public void release() {} public Object getInstance() { return wsInvocation.getInvocationContext().getTargetBean(); } }; if (component instanceof WSComponent) { ((WSComponent) component).setReference(reference); } } final Method method = getComponentViewMethod(wsInvocation.getJavaMethod(), componentView.getViewMethods()); final InterceptorContext context = new InterceptorContext(); prepareForInvocation(context, wsInvocation); context.setMethod(method); context.setParameters(wsInvocation.getArgs()); context.putPrivateData(Component.class, component); context.putPrivateData(ComponentView.class, componentView); if (wsInvocation.getInvocationContext().getProperty("forceTargetBean") != null) { context.putPrivateData(ManagedReference.class, reference); } // invoke method final Object retObj = componentView.invoke(context); // set return value wsInvocation.setReturnValue(retObj); } catch (Throwable t) { handleInvocationException(t); } finally { onAfterInvocation(wsInvocation); } }
/** * Initializes component view name. * * @param endpoint web service endpoint */ public void init(final Endpoint endpoint) { componentViewName = (ServiceName) endpoint.getProperty(COMPONENT_VIEW_NAME); }