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


Java HTTPConduit.setClient方法代码示例

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


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

示例1: createSoapClient

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的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.transport.http.HTTPConduit; //导入方法依赖的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: test

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的package包/类
@GET
@Path("test")
public String test() {

    TestService_Service s = new TestService_Service();
    TestService ts = s.getTestServicePort();

    // 设置客户端的配置信息,超时等.
    Client proxy = ClientProxy.getClient(ts);
    HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
    HTTPClientPolicy policy = new HTTPClientPolicy();

    // 连接服务器超时时间
    policy.setConnectionTimeout(30000);
    // 等待服务器响应超时时间
    policy.setReceiveTimeout(30000);

    conduit.setClient(policy);

    ts.echo();
    return "web service perfect";
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:23,代码来源:WSService.java

示例4: createTrustedWebClient

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的package包/类
public static WebClient createTrustedWebClient( String url, Object provider )
{
    WebClient client = WebClient.create( url, Arrays.asList( provider ) );

    HTTPConduit httpConduit = ( HTTPConduit ) WebClient.getConfig( client ).getConduit();

    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
    httpClientPolicy.setConnectionTimeout( defaultConnectionTimeout );
    httpClientPolicy.setReceiveTimeout( defaultReceiveTimeout );
    httpClientPolicy.setMaxRetransmits( defaultMaxRetransmits );


    httpConduit.setClient( httpClientPolicy );

    SSLManager sslManager = new SSLManager( null, null, null, null );

    TLSClientParameters tlsClientParameters = new TLSClientParameters();
    tlsClientParameters.setDisableCNCheck( true );
    tlsClientParameters.setTrustManagers( sslManager.getClientFullTrustManagers() );
    httpConduit.setTlsClientParameters( tlsClientParameters );

    return client;
}
 
开发者ID:subutai-io,项目名称:base,代码行数:24,代码来源:RestUtil.java

示例5: AccessWSClient

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的package包/类
/**
 * IWS Access WebService Client Constructor. Takes the URL for the WSDL as
 * parameter, to generate a new WebService Client instance.<br />
 *   For example: https://iws.iaeste.net:9443/iws-ws/accessWS?wsdl
 *
 * @param wsdlLocation IWS Access WSDL URL
 * @throws MalformedURLException if not a valid URL
 */
public AccessWSClient(final String wsdlLocation) throws MalformedURLException {
    super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
    client = getPort(ACCESS_SERVICE_PORT, AccessWS.class);

    // The CXF will by default attempt to read the URL from the WSDL at the
    // Server, which is normally given with the server's name. However, as
    // we're running via a load balancer and/or proxies, this address may
    // not be available or resolvable via DNS. Instead, we force using the
    // same WSDL for requests as we use for accessing the server.
    // Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
    ((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);

    // The CXF has a number of default Policy settings, which can all be
    // controlled via the internal Policy Scheme. To override or update the
    // default values, the Policy must be exposed. Which is done by setting
    // a new Policy Scheme which can be access externally.
    // Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
    final Client proxy = ClientProxy.getClient(client);
    final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();

    // Finally, set the Policy into the HTTP Conduit.
    conduit.setClient(policy);
}
 
开发者ID:IWSDevelopers,项目名称:iws,代码行数:32,代码来源:AccessWSClient.java

示例6: ExchangeWSClient

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的package包/类
/**
 * IWS Access WebService Client Constructor. Takes the URL for the WSDL as
 * parameter, to generate a new WebService Client instance.<br />
 *   For example: https://iws.iaeste.net:9443/iws-ws/exchangeWS?wsdl
 *
 * @param wsdlLocation IWS Exchange WSDL URL
 * @throws MalformedURLException if not a valid URL
 */
public ExchangeWSClient(final String wsdlLocation) throws MalformedURLException {
    super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
    client = getPort(ACCESS_SERVICE_PORT, ExchangeWS.class);

    // The CXF will by default attempt to read the URL from the WSDL at the
    // Server, which is normally given with the server's name. However, as
    // we're running via a load balancer and/or proxies, this address may
    // not be available or resolvable via DNS. Instead, we force using the
    // same WSDL for requests as we use for accessing the server.
    // Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
    ((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);

    // The CXF has a number of default Policy settings, which can all be
    // controlled via the internal Policy Scheme. To override or update the
    // default values, the Policy must be exposed. Which is done by setting
    // a new Policy Scheme which can be access externally.
    // Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
    final Client proxy = ClientProxy.getClient(client);
    final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();

    // Finally, set the Policy into the HTTP Conduit.
    conduit.setClient(policy);
}
 
开发者ID:IWSDevelopers,项目名称:iws,代码行数:32,代码来源:ExchangeWSClient.java

示例7: StudentWSClient

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的package包/类
/**
 * IWS Access WebService Client Constructor. Takes the URL for the WSDL as
 * parameter, to generate a new WebService Client instance.<br />
 *   For example: https://iws.iaeste.net:9443/iws-ws/studentWS?wsdl
 *
 * @param wsdlLocation IWS Students WSDL URL
 * @throws MalformedURLException if not a valid URL
 */
public StudentWSClient(final String wsdlLocation) throws MalformedURLException {
    super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
    client = getPort(ACCESS_SERVICE_PORT, StudentWS.class);

    // The CXF will by default attempt to read the URL from the WSDL at the
    // Server, which is normally given with the server's name. However, as
    // we're running via a load balancer and/or proxies, this address may
    // not be available or resolvable via DNS. Instead, we force using the
    // same WSDL for requests as we use for accessing the server.
    // Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
    ((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);

    // The CXF has a number of default Policy settings, which can all be
    // controlled via the internal Policy Scheme. To override or update the
    // default values, the Policy must be exposed. Which is done by setting
    // a new Policy Scheme which can be access externally.
    // Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
    final Client proxy = ClientProxy.getClient(client);
    final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();

    // Finally, set the Policy into the HTTP Conduit.
    conduit.setClient(policy);
}
 
开发者ID:IWSDevelopers,项目名称:iws,代码行数:32,代码来源:StudentWSClient.java

示例8: AccessWSClient

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的package包/类
/**
 * IWS Access WebService Client Constructor. Takes the URL for the WSDL as
 * parameter, to generate a new WebService Client instance.<br />
 *   For example: https://iws.iaeste.net:9443/iws-ws/accessWS?wsdl
 *
 * @param wsdlLocation IWS Access WSDL URL
 * @throws MalformedURLException if not a valid URL
 */
public AccessWSClient(final String wsdlLocation) throws MalformedURLException {
    super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
    client = getPort(ACCESS_SERVICE_PORT, AccessWS.class);

    // The CXF will by default attempt to read the URL from the WSDL at the
    // Server, which is normally given with the server's name. However, as
    // we're running via a loadbalancer and/or proxies, this address may not
    // be available or resolvable via DNS. Instead, we force using the same
    // WSDL for requests as we use for accessing the server.
    // Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
    ((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);

    // The CXF has a number of default Policy settings, which can all be
    // controlled via the internal Policy Scheme. To override or update the
    // default values, the Policy must be exposed. Which is done by setting
    // a new Policy Scheme which can be access externally.
    // Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
    final Client proxy = ClientProxy.getClient(client);
    final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();

    // Finally, set the Policy into the HTTP Conduit.
    conduit.setClient(policy);
}
 
开发者ID:IWSDevelopers,项目名称:iws,代码行数:32,代码来源:AccessWSClient.java

示例9: ExchangeWSClient

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的package包/类
/**
 * IWS Access WebService Client Constructor. Takes the URL for the WSDL as
 * parameter, to generate a new WebService Client instance.<br />
 *   For example: https://iws.iaeste.net:9443/iws-ws/exchangeWS?wsdl
 *
 * @param wsdlLocation IWS Exchange WSDL URL
 * @throws MalformedURLException if not a valid URL
 */
public ExchangeWSClient(final String wsdlLocation) throws MalformedURLException {
    super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
    client = getPort(ACCESS_SERVICE_PORT, ExchangeWS.class);

    // make sure to initialize tlsParams prior to this call somewhere
    //http.setTlsClientParameters(getTlsParams());
    // The CXF will by default attempt to read the URL from the WSDL at the
    // Server, which is normally given with the server's name. However, as
    // we're running via a loadbalancer and/or proxies, this address may not
    // be available or resolvable via DNS. Instead, we force using the same
    // WSDL for requests as we use for accessing the server.
    // Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
    ((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);

    // The CXF has a number of default Policy settings, which can all be
    // controlled via the internal Policy Scheme. To override or update the
    // default values, the Policy must be exposed. Which is done by setting
    // a new Policy Scheme which can be access externally.
    // Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
    final Client proxy = ClientProxy.getClient(client);
    final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();

    // Finally, set the Policy into the HTTP Conduit.
    conduit.setClient(policy);
}
 
开发者ID:IWSDevelopers,项目名称:iws,代码行数:34,代码来源:ExchangeWSClient.java

示例10: start

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的package包/类
public T start(Class<T> cls, String url, boolean trustAllCerts, String trustStore, String trustStorePassword, 
	List<?> providers, int connectTimeout, int receiveTimeout) {

	try {
		
		T resource = JAXRSClientFactory.create(url, cls, providers);
	    HTTPConduit conduit = WebClient.getConfig(resource).getHttpConduit();
	    WebClient.getConfig(resource).getInInterceptors().add(new LoggingInInterceptor());
	    WebClient.getConfig(resource).getOutInterceptors().add(new LoggingOutInterceptor());
		configureHTTPS(resource, conduit, trustAllCerts, trustStore, trustStorePassword);
		
	    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); 
	    httpClientPolicy.setConnectionTimeout(connectTimeout); 
	    httpClientPolicy.setReceiveTimeout(receiveTimeout); 
	    conduit.setClient(httpClientPolicy);
		
		return resource;
		
	} catch (Exception e) {
		LOG.error(" rest client '{}': NOT STARTED", url);
		return null;
	}
	
}
 
开发者ID:csob,项目名称:paymentgateway,代码行数:25,代码来源:JaxRsClientStarter.java

示例11: configureBean

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的package包/类
@Override
public void configureBean(String name, Object beanInstance) {
	if (beanInstance instanceof HTTPConduit) {
		HTTPConduit http = (HTTPConduit) beanInstance;
		TLSClientParameters tls = new TLSClientParameters();
		tls.setTrustManagers(trustManagers);
		tls.setKeyManagers(keyManagers);
		tls.setDisableCNCheck(true);
		tls.setCipherSuitesFilter(getCipherSuites());
		http.setTlsClientParameters(tls);
		HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
		httpClientPolicy.setConnectionTimeout(36000);
		httpClientPolicy.setAllowChunking(false);
		httpClientPolicy.setReceiveTimeout(120000);
		http.setClient(httpClientPolicy);
	} else {
		parentConfigurer.configureBean(name, beanInstance);
	}
}
 
开发者ID:NCIP,项目名称:cagrid2,代码行数:20,代码来源:SoapClientFactory.java

示例12: doRefer

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的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

示例13: getNewClient

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的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

示例14: configHttpConduit

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的package包/类
private void configHttpConduit(Object port) {

        // 设置客户端的配置信息,超时等.
        Client proxy = ClientProxy.getClient(port);
        HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
        HTTPClientPolicy policy = new HTTPClientPolicy();

        // 连接服务器超时时间
        policy.setConnectionTimeout(this.connectTimeout);
        // 等待服务器响应超时时间
        policy.setReceiveTimeout(this.receiveTimeout);

        conduit.setClient(policy);
    }
 
开发者ID:uavorg,项目名称:uavstack,代码行数:15,代码来源:CECXFClient.java

示例15: configureTimeout

import org.apache.cxf.transport.http.HTTPConduit; //导入方法依赖的package包/类
private void configureTimeout(final Client clientProxy) {
    final HTTPConduit conduit = (HTTPConduit) clientProxy.getConduit();
    final HTTPClientPolicy policy = new HTTPClientPolicy();
    policy.setReceiveTimeout(this.wsConfiguration.getReceiveTimeout());
    policy.setConnectionTimeout(this.wsConfiguration.getReceiveTimeout());
    policy.setAsyncExecuteTimeout(this.wsConfiguration.getReceiveTimeout());
    conduit.setClient(policy);
}
 
开发者ID:todvora,项目名称:eet-client,代码行数:9,代码来源:SecureEETCommunication.java


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