本文整理汇总了Java中org.apache.cxf.frontend.ClientProxyFactoryBean.setBus方法的典型用法代码示例。如果您正苦于以下问题:Java ClientProxyFactoryBean.setBus方法的具体用法?Java ClientProxyFactoryBean.setBus怎么用?Java ClientProxyFactoryBean.setBus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.frontend.ClientProxyFactoryBean
的用法示例。
在下文中一共展示了ClientProxyFactoryBean.setBus方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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()));
}
}
示例5: 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;
}
示例6: 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());
}
示例7: 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;
}
示例8: 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();
}