Java Code Examples for org.apache.cxf.bus.CXFBusFactory#createBus()

The following examples show how to use org.apache.cxf.bus.CXFBusFactory#createBus() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebClientSubstitution.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Substitute
static JAXRSClientFactoryBean getBean(String baseAddress, String configLocation) {
    JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
    // configLocation is always null and no need to create SpringBusFactory.
    CXFBusFactory bf = new CXFBusFactory();

    // It can not load the extensions from the bus-extensions.txt dynamically.
    // So have to set all of necessary ones here.
    List<Extension> extensions = new ArrayList<>();
    Extension http = new Extension();
    http.setClassname(HTTPTransportFactory.class.getName());
    http.setDeferred(true);
    extensions.add(http);
    ExtensionRegistry.addExtensions(extensions);

    Bus bus = bf.createBus();
    bus.setExtension(new PhaseManagerImpl(), PhaseManager.class);
    bus.setExtension(new ClientLifeCycleManagerImpl(), ClientLifeCycleManager.class);
    bus.setExtension(new ConduitInitiatorManagerImpl(bus), ConduitInitiatorManager.class);

    bean.setBus(bus);
    bean.setAddress(baseAddress);
    return bean;
}
 
Example 2
Source File: ClientServerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testBase64() 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();
    DynamicClientFactory dynamicClientFactory = DynamicClientFactory.newInstance(bus);
    Client client = dynamicClientFactory.createClient(wsdlUrl);
    assertNotNull(client);
}
 
Example 3
Source File: ClientServerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 4
Source File: ConfiguredEndpointTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testCXFDefaultClientEndpoint() {
    factory = new CXFBusFactory();
    BusFactory.setDefaultBus(null);
    factory.createBus();
    System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, CXFBusFactory.class.getName());
    doTestDefaultClientEndpoint();
}
 
Example 5
Source File: ConfiguredEndpointTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testCXFDefaultServerEndpoint() {
    factory = new CXFBusFactory();
    BusFactory.setDefaultBus(null);
    factory.createBus();
    System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, CXFBusFactory.class.getName());
    initializeBus();
    doTestDefaultServerEndpoint();
}
 
Example 6
Source File: DynamicClientEndpointCreationLoop.java    From cxf with Apache License 2.0 4 votes vote down vote up
private DynamicClientEndpointCreationLoop() {
    CXFBusFactory busFactory = new CXFBusFactory();
    bus = busFactory.createBus();
}