Search in sources :

Example 36 with SOAPService

use of org.apache.hello_world.services.SOAPService in project cxf by apache.

the class SSLv3Test method testAsyncClientSSL3Allowed.

@org.junit.Test
public void testAsyncClientSSL3Allowed() throws Exception {
    // Doesn't work with IBM JDK
    if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
        return;
    }
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = SSLv3Test.class.getResource("sslv3-client-allow.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL url = SOAPService.WSDL_LOCATION;
    SOAPService service = new SOAPService(url, SOAPService.SERVICE);
    assertNotNull("Service is null", service);
    final Greeter port = service.getHttpsPort();
    assertNotNull("Port is null", port);
    // Enable Async
    ((BindingProvider) port).getRequestContext().put("use.async.http.conduit", true);
    updateAddressPort(port, PORT3);
    assertEquals(port.greetMe("Kitty"), "Hello Kitty");
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : SOAPService(org.apache.hello_world.services.SOAPService) Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.hello_world.Greeter) URL(java.net.URL)

Example 37 with SOAPService

use of org.apache.hello_world.services.SOAPService in project cxf by apache.

the class SSLv3Test method testClientSSL3NotAllowed.

@org.junit.Test
public void testClientSSL3NotAllowed() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = SSLv3Test.class.getResource("sslv3-client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL url = SOAPService.WSDL_LOCATION;
    SOAPService service = new SOAPService(url, SOAPService.SERVICE);
    assertNotNull("Service is null", service);
    final Greeter port = service.getHttpsPort();
    assertNotNull("Port is null", port);
    updateAddressPort(port, PORT3);
    try {
        port.greetMe("Kitty");
        fail("Failure expected on the client not supporting SSLv3 by default");
    } catch (Exception ex) {
    // expected
    }
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : SOAPService(org.apache.hello_world.services.SOAPService) Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.hello_world.Greeter) URL(java.net.URL) IOException(java.io.IOException)

Example 38 with SOAPService

use of org.apache.hello_world.services.SOAPService in project cxf by apache.

the class SSLv3Test method testSSL3ClientToEndpointWithSSL3Allowed.

@org.junit.Test
public void testSSL3ClientToEndpointWithSSL3Allowed() throws Exception {
    // Doesn't work with IBM JDK
    if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
        return;
    }
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = SSLv3Test.class.getResource("sslv3-client-allow.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL url = SOAPService.WSDL_LOCATION;
    SOAPService service = new SOAPService(url, SOAPService.SERVICE);
    assertNotNull("Service is null", service);
    final Greeter port = service.getHttpsPort();
    assertNotNull("Port is null", port);
    updateAddressPort(port, PORT4);
    port.greetMe("Kitty");
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : SOAPService(org.apache.hello_world.services.SOAPService) Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) Greeter(org.apache.hello_world.Greeter) URL(java.net.URL)

Example 39 with SOAPService

use of org.apache.hello_world.services.SOAPService in project cxf by apache.

the class HTTPConduitTest method testHttp2HttpRedirect.

/**
 * This method tests if http to http redirects work.
 * Rethwel redirects to Mortimer.
 */
@Test
public void testHttp2HttpRedirect() throws Exception {
    startServer("Mortimer");
    startServer("Rethwel");
    URL config = getClass().getResource("Http2HttpRedirect.cxf");
    // We go through the back door, setting the default bus.
    new DefaultBusFactory().createBus(config);
    URL wsdl = getClass().getResource("greeting.wsdl");
    assertNotNull("WSDL is null", wsdl);
    SOAPService service = new SOAPService(wsdl, serviceName);
    assertNotNull("Service is null", service);
    Greeter rethwel = service.getPort(rethwelQ, Greeter.class);
    updateAddressPort(rethwel, getPort("PORT1"));
    assertNotNull("Port is null", rethwel);
    configureProxy(ClientProxy.getClient(rethwel));
    String answer = rethwel.sayHi();
    assertTrue("Unexpected answer: " + answer, "Bonjour from Mortimer".equals(answer));
    assertProxyRequestCount(2);
}
Also used : SOAPService(org.apache.hello_world.services.SOAPService) Greeter(org.apache.hello_world.Greeter) URL(java.net.URL) Test(org.junit.Test)

Example 40 with SOAPService

use of org.apache.hello_world.services.SOAPService in project cxf by apache.

the class HTTPConduitTest method getMortimerGreeter.

private Greeter getMortimerGreeter() throws MalformedURLException {
    URL wsdl = getClass().getResource("greeting.wsdl");
    assertNotNull("WSDL is null", wsdl);
    SOAPService service = new SOAPService(wsdl, serviceName);
    assertNotNull("Service is null", service);
    Greeter mortimer = service.getPort(mortimerQ, Greeter.class);
    assertNotNull("Port is null", mortimer);
    updateAddressPort(mortimer, getPort("PORT0"));
    configureProxy(ClientProxy.getClient(mortimer));
    return mortimer;
}
Also used : SOAPService(org.apache.hello_world.services.SOAPService) Greeter(org.apache.hello_world.Greeter) URL(java.net.URL)

Aggregations

Greeter (org.apache.hello_world.Greeter)57 SOAPService (org.apache.hello_world.services.SOAPService)57 URL (java.net.URL)56 Bus (org.apache.cxf.Bus)41 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)40 Client (org.apache.cxf.endpoint.Client)14 HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)14 Test (org.junit.Test)13 CertificateException (java.security.cert.CertificateException)9 TLSClientParameters (org.apache.cxf.configuration.jsse.TLSClientParameters)8 TrustManager (javax.net.ssl.TrustManager)7 X509TrustManager (javax.net.ssl.X509TrustManager)7 IOException (java.io.IOException)5 HTTPClientPolicy (org.apache.cxf.transports.http.configuration.HTTPClientPolicy)5 AuthorizationPolicy (org.apache.cxf.configuration.security.AuthorizationPolicy)4 GeneralSecurityException (java.security.GeneralSecurityException)3 BindingProvider (javax.xml.ws.BindingProvider)3 UntrustedURLConnectionIOException (org.apache.cxf.transport.http.UntrustedURLConnectionIOException)3 MalformedURLException (java.net.MalformedURLException)2 InputStream (java.io.InputStream)1