|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
     | 
  |  17 |     | 
   package org.kuali.rice.ksb.messaging.serviceexporters;  | 
  |  18 |     | 
     | 
  |  19 |     | 
     | 
  |  20 |     | 
   import org.apache.cxf.Bus;  | 
  |  21 |     | 
   import org.apache.cxf.aegis.databinding.AegisDatabinding;  | 
  |  22 |     | 
   import org.apache.cxf.endpoint.ServerRegistry;  | 
  |  23 |     | 
   import org.apache.cxf.frontend.ServerFactoryBean;  | 
  |  24 |     | 
   import org.apache.cxf.interceptor.LoggingInInterceptor;  | 
  |  25 |     | 
   import org.apache.cxf.interceptor.LoggingOutInterceptor;  | 
  |  26 |     | 
   import org.apache.cxf.jaxws.JaxWsServerFactoryBean;  | 
  |  27 |     | 
   import org.apache.log4j.Logger;  | 
  |  28 |     | 
   import org.kuali.rice.core.api.exception.RiceRuntimeException;  | 
  |  29 |     | 
   import org.kuali.rice.ksb.api.bus.ServiceDefinition;  | 
  |  30 |     | 
   import org.kuali.rice.ksb.api.bus.support.SoapServiceDefinition;  | 
  |  31 |     | 
   import org.kuali.rice.ksb.security.soap.CXFWSS4JInInterceptor;  | 
  |  32 |     | 
   import org.kuali.rice.ksb.security.soap.CXFWSS4JOutInterceptor;  | 
  |  33 |     | 
     | 
  |  34 |     | 
     | 
  |  35 |     | 
     | 
  |  36 |     | 
     | 
  |  37 |     | 
     | 
  |  38 |     | 
     | 
  |  39 |     | 
   public class SOAPServiceExporter extends AbstractWebServiceExporter implements ServiceExporter { | 
  |  40 |     | 
     | 
  |  41 |    0 |            static final Logger LOG = Logger.getLogger(SOAPServiceExporter.class);  | 
  |  42 |     | 
                     | 
  |  43 |     | 
           public SOAPServiceExporter(SoapServiceDefinition serviceDefinition, Bus cxfBus, ServerRegistry cxfServerRegistry) { | 
  |  44 |    0 |                super(serviceDefinition, cxfBus, cxfServerRegistry);  | 
  |  45 |    0 |            }  | 
  |  46 |     | 
     | 
  |  47 |     | 
             | 
  |  48 |     | 
     | 
  |  49 |     | 
     | 
  |  50 |     | 
     | 
  |  51 |     | 
     | 
  |  52 |     | 
     | 
  |  53 |     | 
           @Override  | 
  |  54 |     | 
       public void publishService(ServiceDefinition serviceDefinition, Object serviceImpl, String address) { | 
  |  55 |     | 
                   ServerFactoryBean svrFactory;  | 
  |  56 |     | 
                     | 
  |  57 |    0 |                    SoapServiceDefinition soapServiceDefinition = (SoapServiceDefinition)serviceDefinition;  | 
  |  58 |     | 
                     | 
  |  59 |     | 
                     | 
  |  60 |    0 |                    if (soapServiceDefinition.isJaxWsService()){ | 
  |  61 |    0 |                            LOG.info("Creating JaxWsService " + soapServiceDefinition.getServiceName()); | 
  |  62 |    0 |                            svrFactory = new JaxWsServerFactoryBean();  | 
  |  63 |     | 
                   } else { | 
  |  64 |    0 |                            svrFactory = new ServerFactoryBean();  | 
  |  65 |     | 
                             | 
  |  66 |     | 
                             | 
  |  67 |    0 |                            svrFactory.getServiceFactory().setDataBinding(new AegisDatabinding());  | 
  |  68 |     | 
                   }  | 
  |  69 |     | 
             | 
  |  70 |    0 |                    svrFactory.setBus(getCXFBus());  | 
  |  71 |    0 |                    svrFactory.setServiceName(soapServiceDefinition.getServiceName());  | 
  |  72 |    0 |                    svrFactory.setAddress(address);  | 
  |  73 |    0 |                    svrFactory.setPublishedEndpointUrl(soapServiceDefinition.getEndpointUrl().toExternalForm());  | 
  |  74 |    0 |                    svrFactory.setServiceBean(serviceImpl);  | 
  |  75 |     | 
                     | 
  |  76 |     | 
                   try { | 
  |  77 |    0 |                            svrFactory.setServiceClass(Class.forName(soapServiceDefinition.getServiceInterface()));  | 
  |  78 |    0 |                    } catch (ClassNotFoundException e) { | 
  |  79 |    0 |                            throw new RiceRuntimeException("Failed to publish service " + soapServiceDefinition.getServiceName() + " because service interface could not be loaded: " + soapServiceDefinition.getServiceInterface(), e); | 
  |  80 |    0 |                    }  | 
  |  81 |     | 
                     | 
  |  82 |     | 
                     | 
  |  83 |    0 |                    svrFactory.getInInterceptors().add(new LoggingInInterceptor());  | 
  |  84 |    0 |                    svrFactory.getInInterceptors().add(new CXFWSS4JInInterceptor(soapServiceDefinition.getBusSecurity()));  | 
  |  85 |     | 
                     | 
  |  86 |    0 |                    svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());  | 
  |  87 |    0 |                    svrFactory.getOutInterceptors().add(new CXFWSS4JOutInterceptor(soapServiceDefinition.getBusSecurity()));  | 
  |  88 |     | 
                     | 
  |  89 |    0 |                    svrFactory.getInFaultInterceptors().add(new CXFWSS4JInInterceptor(soapServiceDefinition.getBusSecurity()));  | 
  |  90 |    0 |                    svrFactory.getOutFaultInterceptors().add(new CXFWSS4JOutInterceptor(soapServiceDefinition.getBusSecurity()));  | 
  |  91 |     | 
                     | 
  |  92 |    0 |                    svrFactory.create();  | 
  |  93 |    0 |            }  | 
  |  94 |     | 
     | 
  |  95 |     | 
   }  |