View Javadoc
1   package org.kuali.ole.docstore.service.impl;
2   
3   import org.apache.cxf.frontend.ClientProxyFactoryBean;
4   import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
5   import org.kuali.ole.docstore.service.OleWebServiceProvider;
6   import org.slf4j.LoggerFactory;
7   
8   import javax.xml.namespace.QName;
9   
10  /**
11   * Created with IntelliJ IDEA.
12   * User: ?
13   * Date: 5/22/12
14   * Time: 6:32 PM
15   * To change this template use File | Settings | File Templates.
16   */
17  public class OleWebServiceProviderImpl
18          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  }