Search in sources :

Example 1 with SpringBusFactory

use of org.apache.cxf.bus.spring.SpringBusFactory in project camel by apache.

the class Server method prepare.

public void prepare() throws Exception {
    // Set a system property used to configure the server.  The examples all run on port 9091; 
    // however, the unit tests must run on a dynamic port.  As such, we make the port configurable
    // in the Spring context.
    System.setProperty("port", "9001");
    // setup the Camel context for the Camel transport
    // START SNIPPET: e1
    SpringBusFactory bf = new SpringBusFactory();
    BusFactory.setDefaultBus(null);
    Bus bus = bf.createBus("/org/apache/camel/example/camel/transport/CamelDestination.xml");
    BusFactory.setDefaultBus(bus);
// END SNIPPET: e1
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory)

Example 2 with SpringBusFactory

use of org.apache.cxf.bus.spring.SpringBusFactory in project camel by apache.

the class WSRMTest method testWSAddressing.

@Test
public void testWSAddressing() throws Exception {
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
    clientBean.setAddress(getClientAddress());
    clientBean.setServiceClass(HelloWorld.class);
    clientBean.setWsdlURL(WSRMTest.class.getResource("/HelloWorld.wsdl").toString());
    SpringBusFactory bf = new SpringBusFactory();
    URL cxfConfig = null;
    if (getCxfClientConfig() != null) {
        cxfConfig = ClassLoaderUtils.getResource(getCxfClientConfig(), this.getClass());
    }
    proxyFactory.setBus(bf.createBus(cxfConfig));
    proxyFactory.getOutInterceptors().add(new MessageLossSimulator());
    HelloWorld client = (HelloWorld) proxyFactory.create();
    String result = client.sayHi("world!");
    assertEquals("Get a wrong response", "Hello world!", result);
}
Also used : SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) ClientFactoryBean(org.apache.cxf.frontend.ClientFactoryBean) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) URL(java.net.URL) Test(org.junit.Test)

Example 3 with SpringBusFactory

use of org.apache.cxf.bus.spring.SpringBusFactory in project camel by apache.

the class WSSecurityRouteTest method testSignature.

@Test
public void testSignature() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = WSSecurityRouteTest.class.getResource("../client/wssec.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    GreeterService gs = new GreeterService();
    Greeter greeter = gs.getGreeterSignaturePort();
    ((BindingProvider) greeter).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + CXFTestSupport.getPort2() + "/WSSecurityRouteTest/GreeterSignaturePort");
    assertEquals("Get a wrong response", "Hello Security", greeter.greetMe("Security"));
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.camel.hello_world_soap_http.Greeter) GreeterService(org.apache.camel.hello_world_soap_http.GreeterService) URL(java.net.URL) Test(org.junit.Test)

Example 4 with SpringBusFactory

use of org.apache.cxf.bus.spring.SpringBusFactory in project camel by apache.

the class WSSecurityRouteTest method testEncryption.

@Test
public void testEncryption() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = WSSecurityRouteTest.class.getResource("../client/wssec.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    GreeterService gs = new GreeterService();
    Greeter greeter = gs.getGreeterEncryptionPort();
    ((BindingProvider) greeter).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + CXFTestSupport.getPort2() + "/WSSecurityRouteTest/GreeterEncryptionPort");
    assertEquals("Get a wrong response", "Hello Security", greeter.greetMe("Security"));
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.camel.hello_world_soap_http.Greeter) GreeterService(org.apache.camel.hello_world_soap_http.GreeterService) URL(java.net.URL) Test(org.junit.Test)

Example 5 with SpringBusFactory

use of org.apache.cxf.bus.spring.SpringBusFactory in project camel by apache.

the class WSAddressingTest method setUp.

@Before
public void setUp() throws Exception {
    template = context.createProducerTemplate();
    JaxWsServerFactoryBean svrBean = new JaxWsServerFactoryBean();
    svrBean.setAddress(getServerAddress());
    svrBean.setServiceClass(Greeter.class);
    svrBean.setServiceBean(new GreeterImpl());
    SpringBusFactory bf = new SpringBusFactory();
    URL cxfConfig = null;
    if (getCxfServerConfig() != null) {
        cxfConfig = ClassLoaderUtils.getResource(getCxfServerConfig(), this.getClass());
    }
    svrBean.setBus(bf.createBus(cxfConfig));
    serviceEndpoint = svrBean.create();
}
Also used : SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) URL(java.net.URL) Before(org.junit.Before)

Aggregations

SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)936 Bus (org.apache.cxf.Bus)859 URL (java.net.URL)773 QName (javax.xml.namespace.QName)394 Service (javax.xml.ws.Service)384 DoubleItPortType (org.example.contract.doubleit.DoubleItPortType)345 Test (org.junit.Test)123 Client (org.apache.cxf.endpoint.Client)83 Greeter (org.apache.hello_world.Greeter)64 SOAPService (org.apache.hello_world.services.SOAPService)64 JAXRSClientFactoryBean (org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean)37 HashMap (java.util.HashMap)36 SamlCallbackHandler (org.apache.cxf.systest.ws.saml.client.SamlCallbackHandler)32 Greeter (org.apache.cxf.greeter_control.Greeter)23 HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)22 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)21 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)20 WebClient (org.apache.cxf.jaxrs.client.WebClient)18 WSS4JOutInterceptor (org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor)18 Closeable (java.io.Closeable)16