01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.messaging.serviceconnectors;
18:
19: import org.codehaus.xfire.aegis.AegisBindingProvider;
20: import org.codehaus.xfire.client.Client;
21: import org.codehaus.xfire.client.XFireProxyFactory;
22: import org.codehaus.xfire.service.Service;
23: import org.codehaus.xfire.service.binding.ObjectServiceFactory;
24: import org.codehaus.xfire.util.dom.DOMInHandler;
25: import org.codehaus.xfire.util.dom.DOMOutHandler;
26: import org.kuali.bus.security.soap.CredentialsOutHandler;
27: import org.kuali.rice.config.xfire.WorkflowXFireWSS4JInHandler;
28: import org.kuali.rice.config.xfire.WorkflowXFireWSS4JOutHandler;
29:
30: import edu.iu.uis.eden.messaging.RemotedServiceHolder;
31: import edu.iu.uis.eden.messaging.SOAPServiceDefinition;
32: import edu.iu.uis.eden.messaging.ServiceInfo;
33:
34: /**
35: *
36: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
37: * @since 0.9
38: */
39: public class SOAPConnector extends AbstractServiceConnector {
40:
41: public SOAPConnector(final ServiceInfo serviceInfo) {
42: super (serviceInfo);
43: }
44:
45: public RemotedServiceHolder getServiceHolder() throws Exception {
46: ObjectServiceFactory serviceFactory = new ObjectServiceFactory(
47: new AegisBindingProvider());
48: XFireProxyFactory proxyFactory = new XFireProxyFactory();
49: Service serviceModel = serviceFactory
50: .create(Class
51: .forName(((SOAPServiceDefinition) getServiceInfo()
52: .getServiceDefinition())
53: .getServiceInterface()));
54: Object service = proxyFactory.create(serviceModel,
55: getServiceInfo().getEndpointUrl());
56: configureClient(Client.getInstance(service));
57: return new RemotedServiceHolder(getServiceProxyWithFailureMode(
58: service, this .getServiceInfo()), this .getServiceInfo());
59: }
60:
61: protected void configureClient(final Client client) {
62: client.addOutHandler(new DOMOutHandler());
63: client
64: .addOutHandler(new org.codehaus.xfire.util.LoggingHandler());
65:
66: if (getCredentialsSource() != null) {
67: client.addOutHandler(new CredentialsOutHandler(
68: getCredentialsSource(), getServiceInfo()));
69: }
70:
71: client.addOutHandler(new WorkflowXFireWSS4JOutHandler(
72: getServiceInfo()));
73: client.addInHandler(new DOMInHandler());
74: client
75: .addInHandler(new org.codehaus.xfire.util.LoggingHandler());
76: client.addInHandler(new WorkflowXFireWSS4JInHandler(
77: getServiceInfo()));
78: }
79: }
|