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.aegis.databinding.AegisDatabinding; |
21 | |
import org.apache.cxf.frontend.ServerFactoryBean; |
22 | |
import org.apache.cxf.interceptor.LoggingInInterceptor; |
23 | |
import org.apache.cxf.interceptor.LoggingOutInterceptor; |
24 | |
import org.apache.cxf.jaxws.JaxWsServerFactoryBean; |
25 | |
import org.apache.log4j.Logger; |
26 | |
import org.kuali.rice.ksb.messaging.SOAPServiceDefinition; |
27 | |
import org.kuali.rice.ksb.messaging.ServiceDefinition; |
28 | |
import org.kuali.rice.ksb.messaging.ServiceInfo; |
29 | |
import org.kuali.rice.ksb.security.soap.CXFWSS4JInInterceptor; |
30 | |
import org.kuali.rice.ksb.security.soap.CXFWSS4JOutInterceptor; |
31 | |
import org.kuali.rice.ksb.service.KSBContextServiceLocator; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
public class SOAPServiceExporter extends AbstractWebServiceExporter implements ServiceExporter { |
39 | |
|
40 | 0 | static final Logger LOG = Logger.getLogger(SOAPServiceExporter.class); |
41 | |
|
42 | |
public SOAPServiceExporter(ServiceInfo serviceInfo) { |
43 | 0 | this(serviceInfo, null); |
44 | 0 | } |
45 | |
|
46 | |
public SOAPServiceExporter(ServiceInfo serviceInfo, KSBContextServiceLocator serviceLocator) { |
47 | 0 | super(serviceInfo, serviceLocator); |
48 | 0 | } |
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
@Override |
57 | |
public void publishService(ServiceDefinition serviceDef, Object serviceImpl, String address) throws Exception{ |
58 | |
ServerFactoryBean svrFactory; |
59 | |
|
60 | |
|
61 | 0 | if (((SOAPServiceDefinition)getServiceInfo().getServiceDefinition()).isJaxWsService()){ |
62 | 0 | LOG.info("Creating JaxWsService " + (getServiceInfo().getQname())); |
63 | 0 | svrFactory = new JaxWsServerFactoryBean(); |
64 | |
} else { |
65 | 0 | svrFactory = new ServerFactoryBean(); |
66 | |
|
67 | |
|
68 | 0 | svrFactory.getServiceFactory().setDataBinding(new AegisDatabinding()); |
69 | |
} |
70 | |
|
71 | 0 | svrFactory.setBus(getCXFBus()); |
72 | 0 | svrFactory.setServiceName(getServiceInfo().getQname()); |
73 | 0 | svrFactory.setAddress(address); |
74 | 0 | svrFactory.setPublishedEndpointUrl(getServiceInfo().getActualEndpointUrl()); |
75 | 0 | svrFactory.setServiceBean(serviceImpl); |
76 | 0 | svrFactory.setServiceClass(Class.forName(((SOAPServiceDefinition)serviceDef).getServiceInterface())); |
77 | |
|
78 | |
|
79 | 0 | svrFactory.getInInterceptors().add(new LoggingInInterceptor()); |
80 | 0 | svrFactory.getInInterceptors().add(new CXFWSS4JInInterceptor(serviceInfo)); |
81 | |
|
82 | 0 | svrFactory.getOutInterceptors().add(new LoggingOutInterceptor()); |
83 | 0 | svrFactory.getOutInterceptors().add(new CXFWSS4JOutInterceptor(serviceInfo)); |
84 | |
|
85 | 0 | svrFactory.getInFaultInterceptors().add(new CXFWSS4JInInterceptor(serviceInfo)); |
86 | 0 | svrFactory.getOutFaultInterceptors().add(new CXFWSS4JOutInterceptor(serviceInfo)); |
87 | |
|
88 | 0 | svrFactory.create(); |
89 | 0 | } |
90 | |
|
91 | |
} |