private void doGreeterRPCLit( SOAPServiceRPCLit service, QName portName, int count, boolean doFault) throws Exception { String response1 = new String("TestGreetMeResponse"); String response2 = new String("TestSayHiResponse"); try { GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class); for (int idx = 0; idx < count; idx++) { String greeting = greeter.greetMe("Milestone-" + idx); assertNotNull("no response received from service", greeting); assertEquals(response1, greeting); String reply = greeter.sayHi(); assertNotNull("no response received from service", reply); assertEquals(response2, reply); if (doFault) { try { greeter.greetMe("throwFault"); } catch (SOAPFaultException ex) { assertNotNull(ex.getFault().getDetail()); assertTrue(ex.getFault().getDetail().getDetailEntries().hasNext()); } } } } catch (UndeclaredThrowableException ex) { throw (Exception) ex.getCause(); } }
@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); String greeting = greeter.greetMe("Milestone-0"); assertNotNull("no response received from service", greeting); assertEquals(response1, greeting); String reply = greeter.sayHi(); assertNotNull("no response received from service", reply); assertEquals(response2, reply); }