use of org.apache.hello_world.services.SOAPService in project cxf by apache.
the class HTTPConduitTest method testHttp2HttpRedirectFail.
/**
* This methods tests that a conduit that is not configured
* to follow redirects will not. The default is not to
* follow redirects.
* Rethwel redirects to Mortimer.
*
* Note: Unfortunately, the invocation will
* "fail" for any number of other reasons.
*/
@Test
public void testHttp2HttpRedirectFail() throws Exception {
startServer("Mortimer");
startServer("Rethwel");
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);
assertNotNull("Port is null", rethwel);
updateAddressPort(rethwel, getPort("PORT1"));
configureProxy(ClientProxy.getClient(rethwel));
String answer = null;
try {
answer = rethwel.sayHi();
fail("Redirect didn't fail. Got answer: " + answer);
} catch (Exception e) {
// e.printStackTrace();
}
assertProxyRequestCount(1);
}
use of org.apache.hello_world.services.SOAPService in project cxf by apache.
the class DigestAuthTest method testNoAuth.
@Test
public void testNoAuth() throws Exception {
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);
TestUtil.setAddress(mortimer, "http://localhost:" + PORT + "/digestauth/greeter");
try {
String answer = mortimer.sayHi();
Assert.fail("Unexpected reply (" + answer + "). Should throw exception");
} catch (Exception e) {
Throwable cause = e.getCause();
Assert.assertEquals(HTTPException.class, cause.getClass());
HTTPException he = (HTTPException) cause;
Assert.assertEquals(401, he.getResponseCode());
}
}
use of org.apache.hello_world.services.SOAPService in project cxf by apache.
the class CipherSuitesTest method testAESIncludedExplicitly.
// Both client + server include a specific AES CipherSuite (not via a filter)
@org.junit.Test
public void testAESIncludedExplicitly() throws Exception {
// Doesn't work with IBM JDK
if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
return;
}
if (!UNRESTRICTED_POLICIES_INSTALLED) {
return;
}
SpringBusFactory bf = new SpringBusFactory();
URL busFile = CipherSuitesTest.class.getResource("ciphersuites-explicit-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, PORT4);
assertEquals(port.greetMe("Kitty"), "Hello Kitty");
((java.io.Closeable) port).close();
bus.shutdown(true);
}
use of org.apache.hello_world.services.SOAPService in project cxf by apache.
the class CipherSuitesTest method testClientAESServerNULL.
// Client does not allow NULL
@org.junit.Test
public void testClientAESServerNULL() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = CipherSuitesTest.class.getResource("ciphersuites-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 not being able to negotiate a cipher suite");
} catch (Exception ex) {
// expected
}
((java.io.Closeable) port).close();
bus.shutdown(true);
}
use of org.apache.hello_world.services.SOAPService in project cxf by apache.
the class CipherSuitesTest method testAESIncludedTLSv12ViaCode.
// Both client + server include AES, client enables a TLS v1.2 CipherSuite
@org.junit.Test
public void testAESIncludedTLSv12ViaCode() throws Exception {
// Doesn't work with IBM JDK
if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
return;
}
SpringBusFactory bf = new SpringBusFactory();
URL busFile = CipherSuitesTest.class.getResource("ciphersuites-client-noconfig.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, PORT);
Client client = ClientProxy.getClient(port);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
TLSClientParameters tlsParams = new TLSClientParameters();
X509TrustManager trustManager = new NoOpX509TrustManager();
TrustManager[] trustManagers = new TrustManager[1];
trustManagers[0] = trustManager;
tlsParams.setTrustManagers(trustManagers);
tlsParams.setDisableCNCheck(true);
tlsParams.setSecureSocketProtocol("TLSv1.2");
tlsParams.setCipherSuites(Collections.singletonList("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"));
conduit.setTlsClientParameters(tlsParams);
assertEquals(port.greetMe("Kitty"), "Hello Kitty");
((java.io.Closeable) port).close();
bus.shutdown(true);
}
Aggregations