View Javadoc
1   package org.kuali.ole.service.impl;
2   
3   import org.apache.cxf.frontend.ClientFactoryBean;
4   import org.apache.cxf.frontend.ClientProxyFactoryBean;
5   import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
6   import org.kuali.ole.service.OleWebServiceProvider;
7   import org.slf4j.LoggerFactory;
8   
9   import javax.xml.namespace.QName;
10  
11  /**
12   * Created with IntelliJ IDEA.
13   * User: ?
14   * Date: 5/22/12
15   * Time: 6:32 PM
16   * To change this template use File | Settings | File Templates.
17   */
18  public class OleWebServiceProviderImpl implements OleWebServiceProvider {
19      org.slf4j.Logger LOG = LoggerFactory.getLogger(OleWebServiceProviderImpl.class);
20      private ClientProxyFactoryBean clientFactory = null;
21  
22      @Override
23      public Object getService(String serviceClassName, String serviceName, String serviceURL) {
24          try {
25              clientFactory = new JaxWsProxyFactoryBean();
26              clientFactory.setServiceClass(Class.forName(serviceClassName));
27          } catch (ClassNotFoundException e) {
28              LOG.error("Failed to connect to soap service because failed to load interface class: ", e);
29          }
30          QName namespaceURI = new QName("http://service.select.ole.kuali.org/", serviceName);
31          clientFactory.setServiceName(namespaceURI);
32          clientFactory.setAddress(serviceURL);
33          Object service = clientFactory.create();
34          return service;
35      }
36  }