1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.ksb.messaging.serviceconnectors; |
18 | |
|
19 | |
import org.apache.cxf.aegis.databinding.AegisDatabinding; |
20 | |
import org.apache.cxf.frontend.ClientProxyFactoryBean; |
21 | |
import org.apache.cxf.interceptor.LoggingInInterceptor; |
22 | |
import org.apache.cxf.interceptor.LoggingOutInterceptor; |
23 | |
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; |
24 | |
import org.kuali.rice.ksb.messaging.SOAPServiceDefinition; |
25 | |
import org.kuali.rice.ksb.messaging.ServiceInfo; |
26 | |
import org.kuali.rice.ksb.security.soap.CXFWSS4JInInterceptor; |
27 | |
import org.kuali.rice.ksb.security.soap.CXFWSS4JOutInterceptor; |
28 | |
import org.kuali.rice.ksb.security.soap.CredentialsOutHandler; |
29 | |
import org.kuali.rice.ksb.service.KSBServiceLocator; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
public class SOAPConnector extends AbstractServiceConnector { |
38 | |
|
39 | |
public SOAPConnector(final ServiceInfo serviceInfo) { |
40 | 0 | super(serviceInfo); |
41 | 0 | } |
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
public Object getService() throws Exception { |
50 | |
ClientProxyFactoryBean clientFactory; |
51 | |
|
52 | |
|
53 | 0 | if (((SOAPServiceDefinition)getServiceInfo().getServiceDefinition()).isJaxWsService()){ |
54 | 0 | clientFactory = new JaxWsProxyFactoryBean(); |
55 | |
} else { |
56 | 0 | clientFactory = new ClientProxyFactoryBean(); |
57 | 0 | clientFactory.getServiceFactory().setDataBinding(new AegisDatabinding()); |
58 | |
} |
59 | |
|
60 | 0 | clientFactory.setBus(KSBServiceLocator.getCXFBus()); |
61 | 0 | clientFactory.setServiceClass(Class.forName(((SOAPServiceDefinition) getServiceInfo().getServiceDefinition()).getServiceInterface())); |
62 | 0 | clientFactory.setServiceName(getServiceInfo().getQname()); |
63 | 0 | clientFactory.setAddress(getServiceInfo().getActualEndpointUrl()); |
64 | |
|
65 | |
|
66 | 0 | clientFactory.getOutInterceptors().add(new LoggingOutInterceptor()); |
67 | 0 | clientFactory.getOutInterceptors().add(new CXFWSS4JOutInterceptor(getServiceInfo())); |
68 | 0 | if (getCredentialsSource() != null) { |
69 | 0 | clientFactory.getOutInterceptors().add(new CredentialsOutHandler(getCredentialsSource(), getServiceInfo())); |
70 | |
} |
71 | |
|
72 | 0 | clientFactory.getInInterceptors().add(new LoggingInInterceptor()); |
73 | 0 | clientFactory.getInInterceptors().add(new CXFWSS4JInInterceptor(getServiceInfo())); |
74 | |
|
75 | 0 | Object service = clientFactory.create(); |
76 | 0 | return getServiceProxyWithFailureMode(service, this.getServiceInfo()); |
77 | |
} |
78 | |
} |