View Javadoc
1   package org.kuali.ole.describe.service.impl;
2   
3   import org.apache.cxf.frontend.ClientProxyFactoryBean;
4   import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
5   import org.kuali.ole.describe.service.OleWebServiceProvider;
6   import org.kuali.rice.core.api.exception.RiceRuntimeException;
7   
8   import javax.xml.namespace.QName;
9   
10  /**
11   * OleWebServiceProviderImpl uses OleWebServiceProvider for consuming webservices which are exposed in other applications.
12   */
13  public class OleWebServiceProviderImpl implements OleWebServiceProvider {
14      private ClientProxyFactoryBean clientFactory = null;
15  
16      /**
17       * Gets the services from JaxWsProxyFactoryBean,And sets the ServiceClass,ServiceName,and URL.
18       *
19       * @param serviceClassName
20       * @param serviceName
21       * @param serviceURL
22       * @return Returns the Service.
23       */
24      @Override
25      public Object getService(String serviceClassName, String serviceName, String serviceURL) {
26          try {
27              clientFactory = new JaxWsProxyFactoryBean();
28              clientFactory.setServiceClass(Class.forName(serviceClassName));
29          } catch (ClassNotFoundException e) {
30              throw new RiceRuntimeException("Failed to connect to soap service because failed to load interface class: ", e);
31          }
32          QName namespaceURI = new QName("http://service.select.ole.kuali.org/", serviceName);
33          clientFactory.setServiceName(namespaceURI);
34          clientFactory.setAddress(serviceURL);
35          Object service = clientFactory.create();
36          return service;
37      }
38  }