use of org.apache.hello_world_rpclit.GreeterRPCLit in project cxf by apache.
the class ProviderRPCClientServerTest method testSOAPMessageModeRPC.
@Test
public void testSOAPMessageModeRPC() throws Exception {
QName serviceName = new QName("http://apache.org/hello_world_rpclit", "SOAPServiceProviderRPCLit");
QName portName = new QName("http://apache.org/hello_world_rpclit", "SoapPortProviderRPCLit1");
URL wsdl = getClass().getResource("/wsdl/hello_world_rpc_lit.wsdl");
assertNotNull(wsdl);
SOAPServiceRPCLit service = new SOAPServiceRPCLit(wsdl, serviceName);
assertNotNull(service);
String response1 = new String("TestGreetMeResponseServerLogicalHandlerServerSOAPHandler");
String response2 = new String("TestSayHiResponse");
GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
updateAddressPort(greeter, PORT);
try {
String greeting = greeter.greetMe("Milestone-0");
assertNotNull("no response received from service", greeting);
assertEquals(response1, greeting);
} catch (Exception e) {
e.printStackTrace();
}
String reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals(response2, reply);
}
use of org.apache.hello_world_rpclit.GreeterRPCLit in project cxf by apache.
the class ClientServerRPCLitTest method testComplexType.
@Test
public void testComplexType() throws Exception {
SOAPServiceRPCLit service = new SOAPServiceRPCLit();
assertNotNull(service);
GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
updateAddressPort(greeter, PORT);
MyComplexStruct in = new MyComplexStruct();
in.setElem1("elem1");
in.setElem2("elem2");
in.setElem3(45);
try {
((BindingProvider) greeter).getRequestContext().put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);
MyComplexStruct out = greeter.sendReceiveData(in);
assertNotNull("no response received from service", out);
assertEquals(in.getElem1(), out.getElem1());
assertEquals(in.getElem2(), out.getElem2());
assertEquals(in.getElem3(), out.getElem3());
} catch (UndeclaredThrowableException ex) {
throw (Exception) ex.getCause();
}
try {
in.setElem2("invalid");
greeter.sendReceiveData(in);
} catch (SOAPFaultException f) {
assertTrue(f.getCause() instanceof UnmarshalException);
}
}
use of org.apache.hello_world_rpclit.GreeterRPCLit in project cxf by apache.
the class RespectBindingFeatureClientServerTest method testRespectBindingFeatureFalse.
@Test
public void testRespectBindingFeatureFalse() throws Exception {
startServers("/wsdl_systest/cxf2006.wsdl");
GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class, new RespectBindingFeature(false));
updateAddressPort(greeter, PORT);
assertEquals("Bonjour", greeter.sayHi());
}
use of org.apache.hello_world_rpclit.GreeterRPCLit in project cxf by apache.
the class RespectBindingFeatureClientServerTest method testOperationRespectBindingFeature.
@Test
public void testOperationRespectBindingFeature() throws Exception {
startServers("/wsdl_systest/cxf_operation_respectbing.wsdl");
try {
GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class, new RespectBindingFeature(true));
updateAddressPort(greeter, PORT);
greeter.greetMe("hello");
fail("WebServiceException is expected");
} catch (Exception ex) {
assertTrue("WebServiceException is expected", ex instanceof javax.xml.ws.WebServiceException);
assertTrue("RespectBindingFeature message is expected: " + ex.getMessage(), ex.getMessage().indexOf("extension with required=true attribute") > -1);
}
}
use of org.apache.hello_world_rpclit.GreeterRPCLit in project cxf by apache.
the class RespectBindingFeatureClientServerTest method testOperationOutputRespectBindingFeature.
@Test
public void testOperationOutputRespectBindingFeature() throws Exception {
startServers("/wsdl_systest/cxf_operation_output_respectbing.wsdl");
try {
GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class, new RespectBindingFeature(true));
updateAddressPort(greeter, PORT);
greeter.greetMe("hello");
fail("WebServiceException is expected");
} catch (Exception ex) {
assertTrue("WebServiceException is expected", ex instanceof javax.xml.ws.WebServiceException);
assertTrue("RespectBindingFeature message is expected: " + ex.getMessage(), ex.getMessage().indexOf("extension with required=true attribute") > -1);
}
}
Aggregations