use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.
the class ServerMisc method run.
protected void run() {
Factory factory = new PerRequestFactory(DocLitWrappedCodeFirstServiceImpl.class);
factory = new PooledFactory(factory, 4);
JAXWSMethodInvoker invoker = new JAXWSMethodInvoker(factory);
JaxWsServerFactoryBean factoryBean;
Map<String, Object> properties = new HashMap<>();
properties.put("bus.jmx.usePlatformMBeanServer", Boolean.TRUE);
properties.put("bus.jmx.enabled", Boolean.TRUE);
Bus b = new CXFBusFactory().createBus(null, properties);
setBus(b);
MetricRegistry registry = new MetricRegistry();
CodahaleMetricsProvider.setupJMXReporter(b, registry);
b.setExtension(registry, MetricRegistry.class);
factoryBean = new JaxWsServerFactoryBean();
factoryBean.setBus(b);
factoryBean.setAddress(DOCLIT_CODEFIRST_URL);
factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
factoryBean.setFeatures(Arrays.asList(new MetricsFeature()));
factoryBean.setInvoker(invoker);
servers.add(factoryBean.create());
factoryBean = new JaxWsServerFactoryBean();
factoryBean.setBus(b);
factoryBean.setAddress(DOCLIT_CODEFIRST_URL_XMLBINDING);
factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
factoryBean.setFeatures(Arrays.asList(new MetricsFeature()));
factoryBean.setInvoker(invoker);
factoryBean.setBindingId("http://cxf.apache.org/bindings/xformat");
factoryBean.setWsdlURL("cxf6866.wsdl");
servers.add(factoryBean.create());
factoryBean = new JaxWsServerFactoryBean();
factoryBean.setAddress(DOCLIT_CODEFIRST_SETTINGS_URL);
factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
factoryBean.setInvoker(invoker);
factoryBean.getServiceFactory().setAnonymousWrapperTypes(true);
factoryBean.getServiceFactory().getServiceConfigurations().add(0, new AbstractServiceConfiguration() {
public Boolean isWrapperPartNillable(MessagePartInfo mpi) {
return Boolean.TRUE;
}
public Long getWrapperPartMinOccurs(MessagePartInfo mpi) {
return Long.valueOf(1L);
}
});
servers.add(factoryBean.create());
// Object implementor4 = new DocLitWrappedCodeFirstServiceImpl();
// endpoints.add(Endpoint.publish(DOCLIT_CODEFIRST_URL, implementor4));
Object implementor7 = new DocLitBareCodeFirstServiceImpl();
EndpointImpl ep = (EndpointImpl) Endpoint.publish(DOCLITBARE_CODEFIRST_URL, implementor7);
ep.getServer().getEndpoint().getInInterceptors().add(new SAAJInInterceptor());
endpoints.add(ep);
Object implementor6 = new InterfaceInheritTestImpl();
endpoints.add(Endpoint.publish(DOCLIT_CODEFIRST_BASE_URL, implementor6));
Object implementor1 = new AnonymousComplexTypeImpl();
String address = "http://localhost:" + PORT + "/anonymous_complex_typeSOAP";
endpoints.add(Endpoint.publish(address, implementor1));
Object implementor2 = new JaxbElementTestImpl();
address = "http://localhost:" + PORT + "/jaxb_element_test";
endpoints.add(Endpoint.publish(address, implementor2));
Object implementor3 = new OrderedParamHolderImpl();
address = "http://localhost:" + PORT + "/ordered_param_holder/";
endpoints.add(Endpoint.publish(address, implementor3));
// Object implementor4 = new DocLitWrappedCodeFirstServiceImpl();
// endpoints.add(Endpoint.publish(DOCLIT_CODEFIRST_URL, implementor4));
Object implementor5 = new RpcLitCodeFirstServiceImpl();
endpoints.add(Endpoint.publish(RPCLIT_CODEFIRST_URL, implementor5));
endpoints.add(Endpoint.publish("http://localhost:" + PORT + "/InheritContext/InheritPort", new InheritImpl()));
endpoints.add(Endpoint.publish(CXF_5064_URL, new SOAPHeaderServiceImpl()));
}
use of org.apache.cxf.bus.CXFBusFactory in project ddf by codice.
the class AbstractStsRealm method getBus.
/**
* Helper method to setup STS Client.
*/
protected Bus getBus() {
BusFactory bf = new CXFBusFactory();
Bus setBus = bf.createBus();
SpringBusFactory.setDefaultBus(setBus);
SpringBusFactory.setThreadDefaultBus(setBus);
return setBus;
}
use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.
the class BusExtensionLoadingTest method testDefaultBusConstruction.
/**
* Test for checking the ExtensionManagerBus is built using the TCCL by default
*
* @throws Exception
*/
@Test
public void testDefaultBusConstruction() throws Exception {
BusFactory factory = new CXFBusFactory();
Bus bus = factory.createBus();
assertNotNullExtensions(bus);
bus.shutdown(true);
}
use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.
the class ConfiguredEndpointTest method xtestCXFConfiguredServerEndpoint.
@Test
public void xtestCXFConfiguredServerEndpoint() {
CXFBusFactory cf = new CXFBusFactory();
factory = cf;
BusFactory.setDefaultBus(null);
Map<String, Object> properties = new HashMap<>();
properties.put(Configurer.USER_CFG_FILE_PROPERTY_NAME, "org/apache/cxf/jaxws/configured-endpoints.xml");
BusFactory.setDefaultBus(cf.createBus(null, properties));
initializeBus();
System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, CXFBusFactory.class.getName());
// doTestConfiguredServerEndpoint();
}
use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.
the class ClientServerTest method testJaxWsDynamicClient.
@Test
public void testJaxWsDynamicClient() throws Exception {
URL wsdl = getClass().getResource("/wsdl/others/dynamic_client_base64.wsdl");
assertNotNull(wsdl);
String wsdlUrl = null;
wsdlUrl = wsdl.toURI().toString();
CXFBusFactory busFactory = new CXFBusFactory();
Bus bus = busFactory.createBus();
org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory dynamicClientFactory = org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory.newInstance(bus);
Client client = dynamicClientFactory.createClient(wsdlUrl);
assertNotNull(client);
}
Aggregations