Search in sources :

Example 71 with JaxWsProxyFactoryBean

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

the class StaxRoundTripActionTest method createClientProxy.

private Echo createClientProxy() {
    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setServiceClass(Echo.class);
    proxyFac.setAddress("local://Echo");
    proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
    return (Echo) proxyFac.create();
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean)

Example 72 with JaxWsProxyFactoryBean

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

the class IssueUnitTest method testRetrieveWSMEX.

@org.junit.Test
public void testRetrieveWSMEX() throws Exception {
    createBus(getClass().getResource("cxf-client.xml").toString());
    // Get Metadata
    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setBindingId(SoapBindingConstants.SOAP11_BINDING_ID);
    proxyFac.setAddress("https://localhost:" + STSPORT + "/SecurityTokenService/Transport/mex");
    MetadataExchange exc = proxyFac.create(MetadataExchange.class);
    Metadata metadata = exc.get2004();
    // Parse response (as per the STSClient)
    Definition definition = null;
    // Parse the MetadataSections into WSDL definition + associated schemas
    for (MetadataSection s : metadata.getMetadataSection()) {
        if ("http://schemas.xmlsoap.org/wsdl/".equals(s.getDialect())) {
            definition = bus.getExtension(WSDLManager.class).getDefinition((Element) s.getAny());
        }
    }
    assertNotNull(definition);
}
Also used : MetadataSection(org.apache.cxf.ws.mex.model._2004_09.MetadataSection) Element(org.w3c.dom.Element) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Metadata(org.apache.cxf.ws.mex.model._2004_09.Metadata) Definition(javax.wsdl.Definition) MetadataExchange(org.apache.cxf.ws.mex.MetadataExchange)

Example 73 with JaxWsProxyFactoryBean

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

the class JaxwsAsyncFailOverTest method testUseFailOverOnClient.

@Test
public void testUseFailOverOnClient() throws Exception {
    List<String> serviceList = new ArrayList<>();
    serviceList.add("http://localhost:" + PORT + "/SoapContext/GreeterPort");
    RandomStrategy strategy = new RandomStrategy();
    strategy.setAlternateAddresses(serviceList);
    FailoverFeature ff = new FailoverFeature();
    ff.setStrategy(strategy);
    // setup the feature by using JAXWS front-end API
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    // set a fake address to kick off the failover feature
    factory.setAddress("http://localhost:" + PORT2 + "/SoapContext/GreeterPort");
    factory.getFeatures().add(ff);
    factory.setServiceClass(Greeter.class);
    Greeter proxy = factory.create(Greeter.class);
    Response<GreetMeResponse> response = proxy.greetMeAsync("cxf");
    int waitCount = 0;
    while (!response.isDone() && waitCount < 15) {
        Thread.sleep(1000);
        waitCount++;
    }
    assertTrue("Response still not received.", response.isDone());
}
Also used : RandomStrategy(org.apache.cxf.clustering.RandomStrategy) Greeter(org.apache.cxf.greeter_control.Greeter) ArrayList(java.util.ArrayList) FailoverFeature(org.apache.cxf.clustering.FailoverFeature) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) GreetMeResponse(org.apache.cxf.greeter_control.types.GreetMeResponse) Test(org.junit.Test)

Example 74 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 Feature feature) {
    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 (feature != null) {
        factory.getFeatures().add(feature);
    }
    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 75 with JaxWsProxyFactoryBean

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

the class OpenTracingTracingTest method createJaxWsService.

private static BookStoreService createJaxWsService(final Map<String, List<String>> headers, final Feature feature) {
    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 (feature != null) {
        factory.getFeatures().add(feature);
    }
    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