Search in sources :

Example 86 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project camel by apache.

the class JaxWSCamelTestSupport method getSampleWSAsyncWithCXFAPI.

public SampleWSAsync getSampleWSAsyncWithCXFAPI(String camelEndpoint) {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setAddress("camel://" + camelEndpoint);
    factory.setServiceClass(SampleWSAsync.class);
    factory.setBus(bus);
    return factory.create(SampleWSAsync.class);
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean)

Example 87 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project ddf by codice.

the class SecureProxyServiceFactoryImpl method createSecureClientFactory.

private <ProxyServiceType> ProxyServiceType createSecureClientFactory(WebServiceProperties<ProxyServiceType> wsp, SecurityToken token) throws UnsupportedOperationException {
    JaxWsProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean();
    boolean populateFromClass = unavailableWsdls.contains(wsp.endpointWsdlURL);
    if (populateFromClass) {
        LOGGER.debug("Using service class to create client rather than WSDL.");
    }
    clientFactory.getClientFactoryBean().getServiceFactory().setPopulateFromClass(populateFromClass);
    LOGGER.debug("Configuring client proxy properties");
    configureProxyFactoryProperties(clientFactory, token, wsp);
    clientFactory.getOutInterceptors().add(new TokenPassThroughInterceptor());
    ProxyServiceType proxyServiceType;
    try {
        proxyServiceType = clientFactory.create(wsp.serviceClass);
    } catch (ServiceConstructionException e) {
        LOGGER.debug("Unable to use WSDL to build client. Attempting to use service class.", e);
        unavailableWsdls.add(wsp.endpointWsdlURL);
        clientFactory.getClientFactoryBean().getServiceFactory().setPopulateFromClass(true);
        proxyServiceType = clientFactory.create(wsp.serviceClass);
    }
    return proxyServiceType;
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) ServiceConstructionException(org.apache.cxf.service.factory.ServiceConstructionException)

Example 88 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.

the class BraveTracingTest method createJaxWsService.

private BookStoreService createJaxWsService(final Map<String, List<String>> headers, final Configurator configurator) throws MalformedURLException {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.getOutInterceptors().add(new LoggingOutInterceptor());
    factory.getInInterceptors().add(new LoggingInInterceptor());
    factory.setServiceClass(BookStoreService.class);
    factory.setAddress("http://localhost:" + PORT + "/BookStore");
    if (configurator != null) {
        configurator.configure(factory);
    }
    final BookStoreService service = (BookStoreService) factory.create();
    final Client proxy = ClientProxy.getClient(service);
    proxy.getRequestContext().put(Message.PROTOCOL_HEADERS, headers);
    return service;
}
Also used : LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) BookStoreService(org.apache.cxf.systest.jaxws.tracing.BookStoreService) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) Client(org.apache.cxf.endpoint.Client)

Example 89 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.

the class HTraceTracingTest method testThatProvidedSpanIsNotClosedWhenActive.

@Test
public void testThatProvidedSpanIsNotClosedWhenActive() throws MalformedURLException {
    final Tracer tracer = createTracer();
    final BookStoreService service = createJaxWsService(new Configurator() {

        @Override
        public void configure(final JaxWsProxyFactoryBean factory) {
            factory.getOutInterceptors().add(new HTraceClientStartInterceptor(tracer));
            factory.getInInterceptors().add(new HTraceClientStopInterceptor());
        }
    });
    try (TraceScope scope = tracer.newScope("test span")) {
        assertThat(service.getBooks().size(), equalTo(2));
        assertThat(Tracer.getCurrentSpan(), not(nullValue()));
        assertThat(TestSpanReceiver.getAllSpans().size(), equalTo(2));
        assertThat(TestSpanReceiver.getAllSpans().get(0).getDescription(), equalTo("Get Books"));
        assertThat(TestSpanReceiver.getAllSpans().get(0).getParents().length, equalTo(1));
        assertThat(TestSpanReceiver.getAllSpans().get(1).getDescription(), equalTo("POST /BookStore"));
    }
    assertThat(TestSpanReceiver.getAllSpans().size(), equalTo(3));
    assertThat(TestSpanReceiver.getAllSpans().get(2).getDescription(), equalTo("test span"));
    final Map<String, List<String>> response = getResponseHeaders(service);
    assertThat(response.get(TracerHeaders.DEFAULT_HEADER_SPAN_ID), not(nullValue()));
}
Also used : HTraceClientStopInterceptor(org.apache.cxf.tracing.htrace.HTraceClientStopInterceptor) Tracer(org.apache.htrace.core.Tracer) HTraceClientStartInterceptor(org.apache.cxf.tracing.htrace.HTraceClientStartInterceptor) BookStoreService(org.apache.cxf.systest.jaxws.tracing.BookStoreService) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) TraceScope(org.apache.htrace.core.TraceScope) List(java.util.List) Test(org.junit.Test)

Example 90 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.

the class OpenTracingTracingTest method createJaxWsService.

private BookStoreService createJaxWsService(final Map<String, List<String>> headers, final Configurator configurator) throws MalformedURLException {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.getOutInterceptors().add(new LoggingOutInterceptor());
    factory.getInInterceptors().add(new LoggingInInterceptor());
    factory.setServiceClass(BookStoreService.class);
    factory.setAddress("http://localhost:" + PORT + "/BookStore");
    if (configurator != null) {
        configurator.configure(factory);
    }
    final BookStoreService service = (BookStoreService) factory.create();
    final Client proxy = ClientProxy.getClient(service);
    proxy.getRequestContext().put(Message.PROTOCOL_HEADERS, headers);
    return service;
}
Also used : LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) BookStoreService(org.apache.cxf.systest.jaxws.tracing.BookStoreService) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) Client(org.apache.cxf.endpoint.Client)

Aggregations

JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)152 Test (org.junit.Test)71 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)21 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)19 AegisDatabinding (org.apache.cxf.aegis.databinding.AegisDatabinding)14 Greeter (org.apache.hello_world_soap_http.Greeter)14 Client (org.apache.cxf.endpoint.Client)13 HashMap (java.util.HashMap)10 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)9 QName (javax.xml.namespace.QName)8 WrappedGreeter (org.apache.hello_world_soap_action.WrappedGreeter)8 BookStoreService (org.apache.cxf.systest.jaxws.tracing.BookStoreService)7 ArrayList (java.util.ArrayList)6 ClientFactoryBean (org.apache.cxf.frontend.ClientFactoryBean)6 Holder (javax.xml.ws.Holder)5 Server (org.apache.cxf.endpoint.Server)5 Greeter (org.apache.cxf.greeter_control.Greeter)5 Service (org.apache.cxf.service.Service)5 HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)5 Metadata (org.apache.cxf.ws.mex.model._2004_09.Metadata)5