String serviceEndpointUrl =
"http://localhost:8080/axis/services/EchoService2";
String qnameService = "EchoService2";
String qnamePort = "EchoServicePort";
Call call;
String echoString = "my echo string";
ServiceFactory serviceFactory = ServiceFactory.newInstance();
Service service = serviceFactory.createService(new QName(qnameService));
call = service.createCall(new QName(qnamePort));
call.setTargetEndpointAddress(serviceEndpointUrl);
call.setOperationName(new QName("http://soapinterop.org/", "echo"));
String returnString = null;
try {
returnString = (String) call.invoke(new Object[]{echoString});
} catch (RemoteException e) {
e.printStackTrace();
fail("Remote exception while calling invoke");
}
assertEquals("returnString does not match echoString",
echoString,
returnString);