当前位置: 首页>>代码示例>>Java>>正文


Java ClientProxyFactoryBean.setServiceClass方法代码示例

本文整理汇总了Java中org.apache.cxf.frontend.ClientProxyFactoryBean.setServiceClass方法的典型用法代码示例。如果您正苦于以下问题:Java ClientProxyFactoryBean.setServiceClass方法的具体用法?Java ClientProxyFactoryBean.setServiceClass怎么用?Java ClientProxyFactoryBean.setServiceClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cxf.frontend.ClientProxyFactoryBean的用法示例。


在下文中一共展示了ClientProxyFactoryBean.setServiceClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSoapClient

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
public <T> T createSoapClient(Class<T> serviceClass, URL endpoint, String namespace)
{
	ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
	Bus bus = new ExtensionManagerBus(null, null, Bus.class.getClassLoader());
	factory.setBus(bus);
	factory.setServiceClass(serviceClass);
	factory.setServiceName(new QName(namespace, serviceClass.getSimpleName()));
	factory.setAddress(endpoint.toString());
	factory.getServiceFactory().getServiceConfigurations().add(0, new XFireCompatabilityConfiguration());
	factory.setDataBinding(new AegisDatabinding());
	@SuppressWarnings("unchecked")
	T soapClient = (T) factory.create();
	Client client = ClientProxy.getClient(soapClient);
	client.getRequestContext().put(Message.MAINTAIN_SESSION, true);
	HTTPClientPolicy policy = new HTTPClientPolicy();
	policy.setReceiveTimeout(600000);
	policy.setAllowChunking(false);
	HTTPConduit conduit = (HTTPConduit) client.getConduit();
	conduit.setClient(policy);
	return soapClient;
}
 
开发者ID:equella,项目名称:Equella,代码行数:22,代码来源:SoapClientFactory.java

示例2: createSoap

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public <T> T createSoap(Class<T> serviceClass, URL endpoint, String namespace, Object previousSession)
{
	ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
	factory.setServiceClass(serviceClass);
	factory.setServiceName(new QName(namespace, serviceClass.getSimpleName()));
	factory.setAddress(endpoint.toString());
	List<AbstractServiceConfiguration> configs = factory.getServiceFactory().getServiceConfigurations();
	configs.add(0, new XFireReturnTypeConfig());
	factory.setDataBinding(new AegisDatabinding());
	T service = (T) factory.create();
	Client client = ClientProxy.getClient(service);
	client.getRequestContext().put(Message.MAINTAIN_SESSION, true);
	HTTPClientPolicy policy = new HTTPClientPolicy();
	policy.setReceiveTimeout(600000);
	policy.setAllowChunking(false);
	HTTPConduit conduit = (HTTPConduit) client.getConduit();
	conduit.setClient(policy);
	if( previousSession != null )
	{
		copyCookiesInt(conduit, previousSession);
	}
	return service;
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:SoapHelper.java

示例3: initializeRemoteServiceRegistry

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
protected ServiceRegistry initializeRemoteServiceRegistry() {
	String registryBootstrapUrl = ConfigContext.getCurrentContextConfig().getProperty(KSBConstants.Config.REGISTRY_SERVICE_URL);
	if (StringUtils.isBlank(registryBootstrapUrl)) {
		throw new RiceRuntimeException("Failed to load registry bootstrap service from url: " + registryBootstrapUrl);
	}
	ClientProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean();
	clientFactory.setServiceClass(ServiceRegistry.class);
	clientFactory.setBus(cxfBus);
	clientFactory.setAddress(registryBootstrapUrl);

       boolean registrySecurity = ConfigContext.getCurrentContextConfig().getBooleanProperty(SERVICE_REGISTRY_SECURITY_CONFIG, true);

	// Set security interceptors
	clientFactory.getOutInterceptors().add(new CXFWSS4JOutInterceptor(registrySecurity));
	clientFactory.getInInterceptors().add(new CXFWSS4JInInterceptor(registrySecurity));

       //Set transformation interceptors
       clientFactory.getInInterceptors().add(new ImmutableCollectionsInInterceptor());
	
	Object service = clientFactory.create();
	if (!(service instanceof ServiceRegistry)) {
		throw new RiceRuntimeException("Endpoint to service registry at URL '" + registryBootstrapUrl + "' was not an instance of ServiceRegistry, instead was: " + service);
	}
	return (ServiceRegistry)service;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:LazyRemoteServiceRegistryConnector.java

示例4: testCallAxis2

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@Test
	@Ignore
	public void testCallAxis2(){
		
		//服务位于: http://localhost/axis2-web/services/myService?wsdl
		
//		JaxWsClientFactoryBean clientBean=new JaxWsClientFactoryBean();
//		JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();
		
		ClientProxyFactoryBean factoryBean=new ClientProxyFactoryBean();
		factoryBean.setAddress("http://localhost/axis2-web/services/myService?wsdl");
		factoryBean.setServiceClass(MyService.class);   //有接口调用
		
		//修复兼容性:
		//发现居然提示命名空间不对,原来是CXF认为命名空间用/结尾,多一个斜杠引起问题
		factoryBean.setServiceName(new QName("http://sevice.test.axis2","MyService"));
		
		factoryBean.getInInterceptors().add(new LoggingInInterceptor());
		factoryBean.getOutInterceptors().add(new LoggingOutInterceptor());
		MyService service=(MyService)factoryBean.create();
		
		System.out.println(service.getHello("将"));//当前类
		String result=service.toBaseString("Hello, jiyi", 100);//父类方法
		System.out.println(result);
	}
 
开发者ID:GeeQuery,项目名称:cxf-plus,代码行数:26,代码来源:CallAxis2.java

示例5: doRefer

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
  protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
  	ClientProxyFactoryBean proxyFactoryBean = new ClientProxyFactoryBean();
  	proxyFactoryBean.setAddress(url.setProtocol("http").toIdentityString());
  	proxyFactoryBean.setServiceClass(serviceType);
  	proxyFactoryBean.setBus(bus);
  	T ref = (T) proxyFactoryBean.create();
  	Client proxy = ClientProxy.getClient(ref);  
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setConnectionTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
policy.setReceiveTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
conduit.setClient(policy);
      return ref;
  }
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:16,代码来源:WebServiceProtocol.java

示例6: getNewClient

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
protected SoapHarvesterService getNewClient(String url, String sharedId, String sharedValue, String username)
{
	try
	{
		final URL endpointUrl = new URL(new URL(url), HARVESTER_ENDPOINT);

		ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
		Bus bus = new ExtensionManagerBus(null, null, Bus.class.getClassLoader());
		factory.setBus(bus);
		factory.setServiceClass(SoapHarvesterService.class);
		factory.setServiceName(
			new QName("http://soap.harvester.core.tle.com", SoapHarvesterService.class.getSimpleName()));
		factory.setAddress(endpointUrl.toString());
		factory.setDataBinding(new AegisDatabinding());
		List<AbstractServiceConfiguration> configs = factory.getServiceFactory().getServiceConfigurations();
		configs.add(0, new XFireReturnTypeConfig());
		SoapHarvesterService soapClient = (SoapHarvesterService) factory.create();
		Client client = ClientProxy.getClient(soapClient);
		client.getRequestContext().put(Message.MAINTAIN_SESSION, true);
		HTTPClientPolicy policy = new HTTPClientPolicy();
		policy.setReceiveTimeout(600000);
		policy.setAllowChunking(false);
		HTTPConduit conduit = (HTTPConduit) client.getConduit();
		// Works?
		// conduit.getTlsClientParameters().setSSLSocketFactory(BlindSSLSocketFactory.getDefaultSSL());
		conduit.setClient(policy);

		soapClient.loginWithToken(TokenGenerator.createSecureToken(username, sharedId, sharedValue, null));
		return soapClient;
	}
	catch( Exception x )
	{
		LOGGER.error("Error connecting to remote EQUELLA server", x);
		throw new RuntimeException(
			CurrentLocale.get("com.tle.core.remoterepo.equella.error.communication", x.getMessage()));
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:38,代码来源:EquellaRepoServiceImpl.java

示例7: getWsClientProxy

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
public static Object getWsClientProxy(
		Class<?> clientClass,
		String wsUrl,
		String wsUserName,
		String wsPassword,
		String authType,
		boolean generateTimestamp,
		boolean logCalls,
		boolean disableCnCheck,
		Integer timeout) {
	ClientProxyFactoryBean factory = new JaxWsProxyFactoryBean();
	factory.setAddress(wsUrl);
	factory.setServiceClass(clientClass);
	if (logCalls) {
		factory.getInInterceptors().add(new LoggingInInterceptor());
		factory.getOutInterceptors().add(new LoggingOutInterceptor());
	}
	String authTypeBo = authType;
	if (authTypeBo == null || authTypeBo.length() == 0) {
		if (wsUserName != null && wsUserName.length() > 0)
			authTypeBo = "BASIC";
	}
	if ("BASIC".equalsIgnoreCase(authTypeBo)) {
		factory.setUsername(wsUserName);
		factory.setPassword(wsPassword);
	} else if ("USERNAMETOKEN".equalsIgnoreCase(authTypeBo)) {
		Map<String, Object> wss4jInterceptorProps = new HashMap<String, Object>();
		if (generateTimestamp) {
			wss4jInterceptorProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN);
		} else {
			wss4jInterceptorProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
		}
		wss4jInterceptorProps.put(WSHandlerConstants.USER, wsUserName);
		wss4jInterceptorProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
		ClientPasswordCallback cp = new ClientPasswordCallback(wsPassword);
		wss4jInterceptorProps.put(WSHandlerConstants.PW_CALLBACK_REF, cp);
		factory.getOutInterceptors().add(new WSS4JOutInterceptor(wss4jInterceptorProps));
	}
	Object c = factory.create();
	
	Client client = ClientProxy.getClient(c);
       HTTPConduit httpConduit = (HTTPConduit)client.getConduit();
       HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
       if (timeout != null) {
       	httpClientPolicy.setConnectionTimeout(timeout);
       	httpClientPolicy.setReceiveTimeout(timeout);
       }
       // Envi­o chunked
	httpClientPolicy.setAllowChunking(isWsClientChunked());
       httpConduit.setClient(httpClientPolicy);
       
	if (disableCnCheck) {
        TLSClientParameters tlsParams = new TLSClientParameters();
        tlsParams.setDisableCNCheck(true);
        httpConduit.setTlsClientParameters(tlsParams);
	}
	return c;
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:59,代码来源:WsClientUtils.java

示例8: doRefer

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
  protected <T> T doRefer(final Class<T> serviceType, final URL url) throws JahhanException {
  	ClientProxyFactoryBean proxyFactoryBean = new ClientProxyFactoryBean();
  	proxyFactoryBean.setAddress(url.setProtocol("http").toIdentityString());
  	proxyFactoryBean.setServiceClass(serviceType);
  	proxyFactoryBean.setBus(bus);
  	T ref = (T) proxyFactoryBean.create();
  	Client proxy = ClientProxy.getClient(ref);  
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setConnectionTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
policy.setReceiveTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
conduit.setClient(policy);
      return ref;
  }
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:16,代码来源:WebServiceProtocol.java

示例9: createCXFClient

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
protected static IncidentService createCXFClient() {
    // we use CXF to create a client for us as its easier than JAXWS and works
    ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
    factory.setServiceClass(IncidentService.class);
    factory.setAddress(URL);
    return (IncidentService) factory.create();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:CamelRouteClient.java

示例10: testInvokeProxyService

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@Test
public void testInvokeProxyService() {
    ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
    factory.setServiceClass(BareSoapService.class);
    factory.setAddress(PROXY_URL);
    factory.setBus(BusFactory.newInstance().createBus());
    BareSoapService client = (BareSoapService) factory.create();

    client.doSomething();

    assertEquals("Proxied service should have been invoked once", 1, IMPLEMENTATION.invocations.get());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:CxfPayLoadBareSoapTest.java

示例11: doRefer

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
    ClientProxyFactoryBean proxyFactoryBean = new ClientProxyFactoryBean();
    proxyFactoryBean.setAddress(url.setProtocol("http").toIdentityString());
    proxyFactoryBean.setServiceClass(serviceType);
    proxyFactoryBean.setBus(bus);
    T ref = (T) proxyFactoryBean.create();
    Client proxy = ClientProxy.getClient(ref);
    HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
    HTTPClientPolicy policy = new HTTPClientPolicy();
    policy.setConnectionTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
    policy.setReceiveTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
    conduit.setClient(policy);
    return ref;
}
 
开发者ID:hufeng,项目名称:dubbo2.js,代码行数:16,代码来源:WebServiceProtocol.java

示例12: setup

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@Before
public void setup() {
	JaxWsServerFactoryBean jaxWsServer = createJaxWsServer();
	jaxWsServer.getHandlers().add(new TraceeClientHandler(serverBackend));
	server = jaxWsServer.create();

	final ClientProxyFactoryBean factoryBean = new ClientProxyFactoryBean();
	factoryBean.getFeatures().add(new LoggingFeature());
	factoryBean.getFeatures().add(new TraceeCxfFeature(clientBackend, Profile.DEFAULT));
	factoryBean.setServiceClass(HelloWorldTestService.class);
	factoryBean.setAddress(endpointAddress);
	helloWorldPort = (HelloWorldTestService) factoryBean.create();
}
 
开发者ID:tracee,项目名称:tracee,代码行数:14,代码来源:CxfClientToJaxwsServerIT.java

示例13: setup

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@Before
public void setup() {
	JaxWsServerFactoryBean jaxWsServer = createJaxWsServer();
	jaxWsServer.getFeatures().add(new LoggingFeature());
	jaxWsServer.getFeatures().add(new TraceeCxfFeature(serverBackend, Profile.DEFAULT));
	server = jaxWsServer.create();

	final ClientProxyFactoryBean factoryBean = new ClientProxyFactoryBean();
	factoryBean.getFeatures().add(new LoggingFeature());
	factoryBean.getFeatures().add(new TraceeCxfFeature(clientBackend, Profile.DEFAULT));
	factoryBean.setServiceClass(HelloWorldTestService.class);
	factoryBean.setBus(CXFBusFactory.getDefaultBus());
	factoryBean.setAddress(endpointAddress);
	helloWorldPort = (HelloWorldTestService) factoryBean.create();
}
 
开发者ID:tracee,项目名称:tracee,代码行数:16,代码来源:CxfClientToCxfServerIT.java

示例14: getClient

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
/**
 * Creates a client for the ServiceDeployer service
 *
 * @param url URL where the service is located
 * @return A client of type ServiceDeployerItf
 */
private static ServiceDeployerItf getClient(String url) {
    ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
    factory.setServiceClass(ServiceDeployerItf.class);
    factory.setAddress(url + WSConstants.SERVICES_PATH + "ServiceDeployer");
    ServiceDeployerItf client = (ServiceDeployerItf) factory.create();
    return client;
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:14,代码来源:PADeployer.java

示例15: tryFailover

import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
private String tryFailover(String url) {

        ClientProxyFactoryBean factory = new ClientProxyFactoryBean();

        factory.setServiceClass(HelloService.class);
        factory.setAddress(url);

        HelloService client = (HelloService)factory.create();
        return client.sayHello();
    }
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:FailOverFeatureTest.java


注:本文中的org.apache.cxf.frontend.ClientProxyFactoryBean.setServiceClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。