response = dispatch.invoke(request);
testAddResponse(response, 40, true);
}
public void testPort() throws Exception {
Calculator calc = null;
// make a call without AddressingFeature
calc = service.getPort(Calculator.class);
try {
calc.add(1, 1);
throw new ServletException("Did not throw exception");
} catch (SOAPFaultException e) {
// that's what we expect
}
// make a call with AddressingFeature disabled
calc = service.getPort(Calculator.class, new AddressingFeature(false, false));
try {
calc.add(1, 1);
throw new ServletException("Did not throw exception");
} catch (SOAPFaultException e) {
// that's what we expect
}
// make a call with AddressingFeature enabled
calc = service.getPort(Calculator.class, new AddressingFeature());
Assert.assertEquals(4, calc.add(2, 2));
// make a call with AddressingFeature enabled and port
calc = service.getPort(PORT, Calculator.class, new AddressingFeature());
Assert.assertEquals(6, calc.add(3, 3));
EndpointReference epr = null;
// make a call using EPR from Binding
epr = ((BindingProvider)calc).getEndpointReference();
calc = service.getPort(epr, Calculator.class, new AddressingFeature());
Assert.assertEquals(8, calc.add(4, 4));
// make a call using EPR from Service
epr = calc.getEPR();
calc = service.getPort(epr, Calculator.class, new AddressingFeature());
Assert.assertEquals(10, calc.add(5, 5));
// make a call using created EPR
epr = createEPR();
calc = service.getPort(epr, Calculator.class, new AddressingFeature());
Assert.assertEquals(12, calc.add(6, 6));
}