Search in sources :

Example 6 with Greeter

use of org.apache.hello_world_soap_http.Greeter in project camel by apache.

the class AbstractCXFGreeterRouterTest method testInvokingServiceFromCXFClient.

@Test
public void testInvokingServiceFromCXFClient() throws Exception {
    Service service = Service.create(serviceName);
    service.addPort(routerPortName, "http://schemas.xmlsoap.org/soap/", "http://localhost:" + getPort2() + "/" + getClass().getSimpleName() + "/CamelContext/RouterPort");
    Greeter greeter = service.getPort(routerPortName, Greeter.class);
    String reply = greeter.greetMe("test");
    assertNotNull("No response received from service", reply);
    assertEquals("Got the wrong reply ", "Hello test", reply);
    reply = greeter.sayHi();
    assertNotNull("No response received from service", reply);
    assertEquals("Got the wrong reply ", "Bonjour", reply);
    greeter.greetMeOneWay("call greetMe OneWay !");
    // test throw the exception
    try {
        greeter.testDocLitFault("NoSuchCodeLitFault");
        // should get the exception here
        fail("Should get the NoSuchCodeLitFault here.");
    } catch (NoSuchCodeLitFault fault) {
        // expect the fault here
        assertNotNull("The fault info should not be null", fault.getFaultInfo());
    }
}
Also used : NoSuchCodeLitFault(org.apache.hello_world_soap_http.NoSuchCodeLitFault) Greeter(org.apache.hello_world_soap_http.Greeter) Service(javax.xml.ws.Service) Test(org.junit.Test)

Example 7 with Greeter

use of org.apache.hello_world_soap_http.Greeter in project camel by apache.

the class CxfTimeoutTest method startService.

@BeforeClass
public static void startService() {
    Greeter implementor = new GreeterImplWithSleep();
    Endpoint.publish(JAXWS_SERVER_ADDRESS, implementor);
}
Also used : Greeter(org.apache.hello_world_soap_http.Greeter) BeforeClass(org.junit.BeforeClass)

Example 8 with Greeter

use of org.apache.hello_world_soap_http.Greeter in project camel by apache.

the class CxfMessageHeaderTimeoutTest method startService.

@BeforeClass
public static void startService() {
    Greeter implementor = new GreeterImplWithSleep();
    Endpoint.publish(SERVER_ADDRESS, implementor);
}
Also used : Greeter(org.apache.hello_world_soap_http.Greeter) BeforeClass(org.junit.BeforeClass)

Example 9 with Greeter

use of org.apache.hello_world_soap_http.Greeter in project camel by apache.

the class CxfOneWayRouteTest method getCXFClient.

protected Greeter getCXFClient() throws Exception {
    Service service = Service.create(SERVICE_NAME);
    service.addPort(PORT_NAME, "http://schemas.xmlsoap.org/soap/", ROUTER_ADDRESS);
    Greeter greeter = service.getPort(PORT_NAME, Greeter.class);
    return greeter;
}
Also used : Greeter(org.apache.hello_world_soap_http.Greeter) Service(javax.xml.ws.Service)

Example 10 with Greeter

use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.

the class DirectDispatchClientTest method invokeService.

private void invokeService(boolean isDirectDispatch) {
    BusFactory.setThreadDefaultBus(staticBus);
    Service service = Service.create(serviceName);
    service.addPort(localPortName, "http://schemas.xmlsoap.org/soap/", "local://Greeter");
    Greeter greeter = service.getPort(localPortName, Greeter.class);
    if (isDirectDispatch) {
        Client client = ClientProxy.getClient(greeter);
        client.getOutInterceptors().add(new GZIPOutInterceptor(50));
        client.getInInterceptors().add(new GZIPInInterceptor());
        InvocationHandler handler = Proxy.getInvocationHandler(greeter);
        BindingProvider bp = null;
        if (handler instanceof BindingProvider) {
            bp = (BindingProvider) handler;
            Map<String, Object> requestContext = bp.getRequestContext();
            requestContext.put(LocalConduit.DIRECT_DISPATCH, true);
        }
    }
    String reply = greeter.greetMe("test");
    assertEquals("Hello test", reply);
    reply = greeter.sayHi();
    assertNotNull("no response received from service", reply);
    assertEquals("Bonjour", reply);
}
Also used : GZIPOutInterceptor(org.apache.cxf.transport.common.gzip.GZIPOutInterceptor) Greeter(org.apache.hello_world_soap_http.Greeter) Service(javax.xml.ws.Service) GZIPInInterceptor(org.apache.cxf.transport.common.gzip.GZIPInInterceptor) BindingProvider(javax.xml.ws.BindingProvider) Client(org.apache.cxf.endpoint.Client) InvocationHandler(java.lang.reflect.InvocationHandler)

Aggregations

Greeter (org.apache.hello_world_soap_http.Greeter)104 Test (org.junit.Test)78 SOAPService (org.apache.hello_world_soap_http.SOAPService)55 URL (java.net.URL)47 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)24 BindingProvider (javax.xml.ws.BindingProvider)23 SOAPServiceBogusAddressTest (org.apache.hello_world_soap_http.SOAPServiceBogusAddressTest)21 SOAPServiceMultiPortTypeTest (org.apache.hello_world_soap_http.SOAPServiceMultiPortTypeTest)21 Service (javax.xml.ws.Service)19 Client (org.apache.cxf.endpoint.Client)17 Endpoint (javax.xml.ws.Endpoint)13 QName (javax.xml.namespace.QName)10 Bus (org.apache.cxf.Bus)10 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)10 ExecutorService (java.util.concurrent.ExecutorService)9 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)7 File (java.io.File)6 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)6 GreetMeLaterResponse (org.apache.hello_world_soap_http.types.GreetMeLaterResponse)6 InvocationHandler (java.lang.reflect.InvocationHandler)5