Java Code Examples for org.apache.camel.component.cxf.CxfEndpoint#setServiceClass()

The following examples show how to use org.apache.camel.component.cxf.CxfEndpoint#setServiceClass() . 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: Application.java    From wildfly-camel-examples with Apache License 2.0 6 votes vote down vote up
@Named("cxfProducerEndpoint")
@Produces
public CxfEndpoint createCxfProducerEndpoint() {
    CxfEndpoint cxfProducerEndpoint = this.camelContext.getEndpoint(CXF_ENDPOINT_URI, CxfEndpoint.class);
    cxfProducerEndpoint.setBeanId("cxfProducerEndpoint");
    cxfProducerEndpoint.setServiceClass(GreetingService.class);

    SSLContextParameters producerSslContextParameters = this.createProducerSSLContextParameters();
    cxfProducerEndpoint.setSslContextParameters(producerSslContextParameters);

    // Not for use in production
    HostnameVerifier hostnameVerifier = new HostnameVerifier() {
        @Override
        public boolean verify(String hostname, SSLSession session) {
            return true;
        }
    };
    cxfProducerEndpoint.setHostnameVerifier(hostnameVerifier);

    return cxfProducerEndpoint;
}
 
Example 2
Source File: ApplicationB.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
@Named("cxfProducerEndpointB")
@Produces
public CxfEndpoint createCxfProducerEndpoint() {
    CxfComponent cxfProducerComponent = new CxfComponent(this.camelContext);
    CxfEndpoint cxfProducerEndpoint = new CxfEndpoint(CXF_ENDPOINT_URI, cxfProducerComponent);
    cxfProducerEndpoint.setBeanId("cxfProducerEndpointB");
    cxfProducerEndpoint.setServiceClass(GreetingService.class);

    // Not for use in production
    HostnameVerifier hostnameVerifier = new HostnameVerifier() {
        @Override
        public boolean verify(String hostname, SSLSession session) {
            return true;
        }
    };
    cxfProducerEndpoint.setHostnameVerifier(hostnameVerifier);

    return cxfProducerEndpoint;
}
 
Example 3
Source File: Application.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
@Named("cxfProducerEndpoint")
@Produces
public CxfEndpoint createCxfProducerEndpoint() {
    CxfComponent cxfProducerComponent = new CxfComponent(this.camelContext);
    CxfEndpoint cxfProducerEndpoint = new CxfEndpoint(CXF_ENDPOINT_URI, cxfProducerComponent);
    cxfProducerEndpoint.setBeanId("cxfProducerEndpoint");
    cxfProducerEndpoint.setServiceClass(GreetingService.class);

    // Not for use in production
    HostnameVerifier hostnameVerifier = new HostnameVerifier() {
        @Override
        public boolean verify(String hostname, SSLSession session) {
            return true;
        }
    };
    cxfProducerEndpoint.setHostnameVerifier(hostnameVerifier);

    return cxfProducerEndpoint;
}
 
Example 4
Source File: Application.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
@Named("cxfProducerEndpointSub")
@Produces
public CxfEndpoint createCxfProducerEndpointSub() {
    CxfComponent cxfProducerComponent = new CxfComponent(this.camelContext);
    CxfEndpoint cxfProducerEndpoint = new CxfEndpoint(CXF_ENDPOINT_SUB_URI, cxfProducerComponent);
    cxfProducerEndpoint.setBeanId("cxfProducerEndpointSub");
    cxfProducerEndpoint.setServiceClass(GreetingService.class);

    // Not for use in production
    HostnameVerifier hostnameVerifier = new HostnameVerifier() {
        @Override
        public boolean verify(String hostname, SSLSession session) {
            return true;
        }
    };
    cxfProducerEndpoint.setHostnameVerifier(hostnameVerifier);

    return cxfProducerEndpoint;
}
 
Example 5
Source File: Application.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
@Named("cxfProducerEndpointRel")
@Produces
public CxfEndpoint createCxfProducerEndpointRel() {
    CxfComponent cxfProducerComponent = new CxfComponent(this.camelContext);
    CxfEndpoint cxfProducerEndpoint = new CxfEndpoint(CXF_ENDPOINT_REL_URI, cxfProducerComponent);
    cxfProducerEndpoint.setBeanId("cxfProducerEndpointRel");
    cxfProducerEndpoint.setServiceClass(GreetingService.class);

    // Not for use in production
    HostnameVerifier hostnameVerifier = new HostnameVerifier() {
        @Override
        public boolean verify(String hostname, SSLSession session) {
            return true;
        }
    };
    cxfProducerEndpoint.setHostnameVerifier(hostnameVerifier);

    return cxfProducerEndpoint;
}
 
Example 6
Source File: Application.java    From wildfly-camel-examples with Apache License 2.0 5 votes vote down vote up
@Named("cxfConsumerEndpoint")
@Produces
public CxfEndpoint createCxfConsumerEndpoint() {
    CxfEndpoint cxfConsumerEndpoint = this.camelContext.getEndpoint(CXF_ENDPOINT_URI, CxfEndpoint.class);
    cxfConsumerEndpoint.setBeanId("cxfConsumerEndpoint");
    cxfConsumerEndpoint.setServiceClass(GreetingService.class);

    return cxfConsumerEndpoint;
}
 
Example 7
Source File: Application.java    From wildfly-camel-examples with Apache License 2.0 5 votes vote down vote up
@Named("cxfConsumer")
@Produces
public CxfEndpoint createCxfConsumer() {
    CxfEndpoint cxfFromEndpoint = context.getEndpoint(CXF_ENDPOINT_URI, CxfEndpoint.class);
    cxfFromEndpoint.setServiceClass(GreetingService.class);
    return cxfFromEndpoint;
}
 
Example 8
Source File: Application.java    From wildfly-camel-examples with Apache License 2.0 5 votes vote down vote up
@Named("cxfProducer")
@Produces
public CxfEndpoint createCxfProducer() {
    CxfEndpoint cxfToEndpoint = context.getEndpoint(CXF_ENDPOINT_URI, CxfEndpoint.class);
    cxfToEndpoint.setServiceClass(GreetingService.class);
    return cxfToEndpoint;
}
 
Example 9
Source File: CXFWSJAASAuthenticationIntegrationTest.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
private CamelContext configureCamelContext(String password) throws Exception {
    CamelContext camelctx = new DefaultCamelContext();

    CxfComponent component = new CxfComponent(camelctx);
    CxfEndpoint consumerEndpoint = new CxfEndpoint("http://localhost:8080/webservices/greeting", component);
    consumerEndpoint.setServiceClass(Endpoint.class);

    List<Interceptor<? extends Message>> inInterceptors = consumerEndpoint.getInInterceptors();
    JAASLoginInterceptor interceptor =  new JAASLoginInterceptor();
    interceptor.setContextName("other");
    inInterceptors.add(interceptor);

    CxfEndpoint producerEndpoint = new CxfEndpoint("http://localhost:8080/webservices/greeting", component);
    producerEndpoint.setServiceClass(Endpoint.class);
    producerEndpoint.setUsername("user1");
    producerEndpoint.setPassword(password);

    Map<String, Object> properties = producerEndpoint.getProperties();
    if (properties == null) {
        producerEndpoint.setProperties(new HashMap<>());
    }

    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
            .to(producerEndpoint);

            from(consumerEndpoint)
            .process(exchange -> {
                Object[] args = exchange.getIn().getBody(Object[].class);
                exchange.getOut().setBody("Hello " + args[0]);
            });
        }
    });
    return camelctx;
}
 
Example 10
Source File: ApplicationB.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Named("cxfConsumerEndpointB")
@Produces
public CxfEndpoint createCxfConsumerEndpoint() {
    CxfComponent cxfConsumerComponent = new CxfComponent(this.camelContext);
    CxfEndpoint cxfConsumerEndpoint = new CxfEndpoint(CXF_ENDPOINT_URI, cxfConsumerComponent);
    cxfConsumerEndpoint.setBeanId("cxfConsumerEndpointB");
    cxfConsumerEndpoint.setServiceClass(GreetingService.class);
    return cxfConsumerEndpoint;
}
 
Example 11
Source File: Application.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Named("cxfConsumerEndpoint")
@Produces
public CxfEndpoint createCxfConsumerEndpoint() {
    CxfComponent cxfConsumerComponent = new CxfComponent(this.camelContext);
    CxfEndpoint cxfConsumerEndpoint = new CxfEndpoint(CXF_ENDPOINT_URI, cxfConsumerComponent);
    cxfConsumerEndpoint.setBeanId("cxfConsumerEndpoint");
    cxfConsumerEndpoint.setServiceClass(GreetingService.class);
    return cxfConsumerEndpoint;
}
 
Example 12
Source File: Application.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Named("cxfConsumerEndpointSub")
@Produces
public CxfEndpoint createCxfConsumerEndpointSub() {
    CxfComponent cxfConsumerComponent = new CxfComponent(this.camelContext);
    CxfEndpoint cxfConsumerEndpoint = new CxfEndpoint(CXF_ENDPOINT_SUB_URI, cxfConsumerComponent);
    cxfConsumerEndpoint.setBeanId("cxfConsumerEndpointSub");
    cxfConsumerEndpoint.setServiceClass(GreetingService.class);
    return cxfConsumerEndpoint;
}
 
Example 13
Source File: Application.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Named("cxfConsumerEndpointRel")
@Produces
public CxfEndpoint createCxfConsumerEndpointRel() {
    CxfComponent cxfConsumerComponent = new CxfComponent(this.camelContext);
    CxfEndpoint cxfConsumerEndpoint = new CxfEndpoint(CXF_ENDPOINT_REL_URI, cxfConsumerComponent);
    cxfConsumerEndpoint.setBeanId("cxfConsumerEndpointRel");
    cxfConsumerEndpoint.setServiceClass(GreetingService.class);
    return cxfConsumerEndpoint;
}
 
Example 14
Source File: CXFWSInterceptorTest.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Test
public void testCXFInterceptor() throws Exception {
    CountDownLatch latch = new CountDownLatch(1);

    CamelContext camelctx = new DefaultCamelContext();

    CxfComponent component = new CxfComponent(camelctx);
    CxfEndpoint cxfEndpoint = new CxfEndpoint("http://localhost:8080/EndpointService/EndpointPort", component);
    cxfEndpoint.setServiceClass(Endpoint.class);

    List<Interceptor<? extends Message>> inInterceptors = cxfEndpoint.getInInterceptors();
    inInterceptors.add(new CountDownInterceptor(latch));

    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from(cxfEndpoint)
            .setBody(constant("Hello ${body}"));
        }
    });

    camelctx.start();
    try {
        QName qname = new QName("http://wildfly.camel.test.cxf", "EndpointService");
        Service service = Service.create(new URL("http://localhost:8080/EndpointService/EndpointPort?wsdl"), qname);
        Endpoint endpoint = service.getPort(Endpoint.class);
        endpoint.echo("Kermit");
        Assert.assertTrue("Gave up waiting for CXF interceptor handleMessage", latch.await(5, TimeUnit.SECONDS));
    } finally {
        camelctx.close();
    }
}
 
Example 15
Source File: CXFWSSecureConsumerIntegrationTest.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
private CxfEndpoint createCxfEndpoint(String endpointUrl, CxfComponent component) throws Exception {
    CxfEndpoint cxfEndpoint = new CxfEndpoint(endpointUrl, component);
    cxfEndpoint.setServiceClass(Endpoint.class.getName());
    return cxfEndpoint;
}