use of java.lang.reflect.UndeclaredThrowableException in project cxf by apache.
the class HeaderClientServerTest method testReturnHeader.
@Test
public void testReturnHeader() throws Exception {
URL wsdl = getClass().getResource("/wsdl/soapheader.wsdl");
assertNotNull(wsdl);
SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
assertNotNull(service);
TestHeader proxy = service.getPort(portName, TestHeader.class);
try {
Holder<TestHeader5ResponseBody> out = new Holder<TestHeader5ResponseBody>();
Holder<TestHeader5> outHeader = new Holder<TestHeader5>();
TestHeader5 in = new TestHeader5();
String val = new String(TestHeader5.class.getSimpleName());
for (int idx = 0; idx < 2; idx++) {
val += idx;
in.setRequestType(val);
proxy.testHeader5(out, outHeader, in);
assertEquals(1000, out.value.getResponseType());
assertEquals(val, outHeader.value.getRequestType());
}
} catch (UndeclaredThrowableException ex) {
throw (Exception) ex.getCause();
}
}
use of java.lang.reflect.UndeclaredThrowableException in project cxf by apache.
the class ClientServerWebSocketTest method testBasicConnection2.
@Test
public void testBasicConnection2() throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
SOAPService service = new SOAPService(wsdl, serviceName);
// getPort only passing in SEI
Greeter greeter = service.getPort(Greeter.class);
updateGreeterAddress(greeter, PORT);
String response1 = new String("Hello Milestone-");
String response2 = new String("Bonjour");
try {
for (int idx = 0; idx < 5; idx++) {
String greeting = greeter.greetMe("Milestone-" + idx);
assertNotNull("no response received from service", greeting);
String exResponse = response1 + idx;
assertEquals(exResponse, greeting);
String reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals(response2, reply);
greeter.greetMeOneWay("Milestone-" + idx);
}
} catch (UndeclaredThrowableException ex) {
throw (Exception) ex.getCause();
}
}
use of java.lang.reflect.UndeclaredThrowableException in project cxf by apache.
the class ClientServerWebSocketTest method testBasicConnectionAndOneway.
@Test
public void testBasicConnectionAndOneway() throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
SOAPService service = new SOAPService(wsdl, serviceName);
Greeter greeter = service.getPort(portName, Greeter.class);
updateGreeterAddress(greeter, PORT);
String response1 = new String("Hello Milestone-");
String response2 = new String("Bonjour");
try {
for (int idx = 0; idx < 1; idx++) {
String greeting = greeter.greetMe("Milestone-" + idx);
assertNotNull("no response received from service", greeting);
String exResponse = response1 + idx;
assertEquals(exResponse, greeting);
String reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals(response2, reply);
greeter.greetMeOneWay("Milestone-" + idx);
}
} catch (UndeclaredThrowableException ex) {
throw (Exception) ex.getCause();
}
}
use of java.lang.reflect.UndeclaredThrowableException in project cxf by apache.
the class ClientServerWebSocketTest method testBasicConnection.
@Test
public void testBasicConnection() throws Exception {
SOAPService service = new SOAPService();
Greeter greeter = service.getPort(portName, Greeter.class);
updateGreeterAddress(greeter, PORT);
try {
String reply = greeter.greetMe("test");
assertNotNull("no response received from service", reply);
assertEquals("Hello test", reply);
reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals("Bonjour", reply);
} catch (UndeclaredThrowableException ex) {
throw (Exception) ex.getCause();
}
BindingProvider bp = (BindingProvider) greeter;
Map<String, Object> responseContext = bp.getResponseContext();
Integer responseCode = (Integer) responseContext.get(Message.RESPONSE_CODE);
assertEquals(200, responseCode.intValue());
}
use of java.lang.reflect.UndeclaredThrowableException in project cxf by apache.
the class ProviderClientServerTest method testSOAPMessageModeDocLitWithSchemaValidation.
@Test
public void testSOAPMessageModeDocLitWithSchemaValidation() throws Exception {
QName serviceName = new QName("http://apache.org/hello_world_soap_http", "SOAPProviderService");
QName portName = new QName("http://apache.org/hello_world_soap_http", "SoapProviderPort");
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
SOAPService service = new SOAPService(wsdl, serviceName);
assertNotNull(service);
try {
Greeter greeter = service.getPort(portName, Greeter.class);
setAddress(greeter, ADDRESS);
try {
greeter.greetMe("this is a greetMe message which length is more " + "than 30 so that I wanna a schema validation error");
fail("Should have thrown an exception");
} catch (Exception ex) {
// expected
assertTrue(ex.getMessage().contains("the length of the value is 96, but the required maximum is 30"));
}
try {
greeter.greetMe("exceed maxLength");
fail("Should have thrown an exception");
} catch (Exception ex) {
// expected
assertTrue(ex.getMessage().contains("cvc-maxLength-valid"));
}
} catch (UndeclaredThrowableException ex) {
throw (Exception) ex.getCause();
}
}
Aggregations