use of org.apache.hello_world.services.SOAPService in project cxf by apache.
the class HTTPConduitTest method testHttp2HttpLoopRedirectFail.
/**
* This methods tests that a redirection loop will fail.
* Hurlon redirects to Abost, which redirects to Hurlon.
*
* Note: Unfortunately, the invocation may "fail" for any
* number of reasons.
*/
@Test
public void testHttp2HttpLoopRedirectFail() throws Exception {
startServer("Abost");
startServer("Hurlon");
URL config = getClass().getResource("Http2HttpLoopRedirectFail.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 hurlon = service.getPort(hurlonQ, Greeter.class);
assertNotNull("Port is null", hurlon);
updateAddressPort(hurlon, getPort("PORT3"));
configureProxy(ClientProxy.getClient(hurlon));
String answer = null;
try {
answer = hurlon.sayHi();
fail("Redirect didn't fail. Got answer: " + answer);
} catch (Exception e) {
// This exception will be one of not being able to
// read from the StreamReader
// e.printStackTrace();
}
assertProxyRequestCount(2);
}
use of org.apache.hello_world.services.SOAPService in project cxf by apache.
the class DigestAuthTest method testDigestAuth.
@Test
public void testDigestAuth() 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");
Client client = ClientProxy.getClient(mortimer);
HTTPConduit http = (HTTPConduit) client.getConduit();
AuthorizationPolicy authPolicy = new AuthorizationPolicy();
authPolicy.setAuthorizationType("Digest");
authPolicy.setUserName("foo");
authPolicy.setPassword("bar");
http.setAuthorization(authPolicy);
String answer = mortimer.sayHi();
assertEquals("Unexpected answer: " + answer, "Hi", answer);
}
use of org.apache.hello_world.services.SOAPService in project cxf by apache.
the class CipherSuitesTest method testClientAESServerRC4IncludedAsync.
// Client only includes AES, server only includes RC4
@org.junit.Test
public void testClientAESServerRC4IncludedAsync() 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);
// Enable Async
((BindingProvider) port).getRequestContext().put("use.async.http.conduit", true);
updateAddressPort(port, PORT2);
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 testAESIncludedTLSv10.
// Both client + server include AES, client is TLSv1.0
@org.junit.Test
public void testAESIncludedTLSv10() throws Exception {
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");
conduit.setTlsClientParameters(tlsParams);
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 testAESIncludedTLSv11.
// Both client + server include AES, client is TLSv1.1
@org.junit.Test
public void testAESIncludedTLSv11() 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.1");
conduit.setTlsClientParameters(tlsParams);
assertEquals(port.greetMe("Kitty"), "Hello Kitty");
((java.io.Closeable) port).close();
bus.shutdown(true);
}
Aggregations