portName, address);
setupCallbackObject(useAutomaticWorkQueue);
server.activate(callback);
ClientTransport client = createClientTransport(factory, wsdlUrl, serviceName, portName);
assertTrue("targetEndpoint address mismatch. Expected : " + address
+ " received : " + client.getTargetEndpoint(),
address.equals(client.getTargetEndpoint().getAddress().getValue()));
OutputStreamMessageContext octx = null;
byte outBytes[] = "Hello World!!!".getBytes();
InputStreamMessageContext ictx = doClientInvoke(client, octx, outBytes, false);
byte bytes[] = new byte[10000];
int len = ictx.getInputStream().read(bytes);
assertTrue("Did not read anything " + len, len > 0);
assertEquals(new String(outBytes), new String(bytes, 0, len));
//long request
outBytes = new byte[5000];
for (int x = 0; x < outBytes.length; x++) {
outBytes[x] = (byte)('a' + (x % 26));
}
ictx = doClientInvoke(client, octx, outBytes, false);
int total = readBytes(bytes, ictx.getInputStream());
assertTrue("Did not read anything " + total, total > 0);
assertEquals(new String(outBytes), new String(bytes, 0, total));
outBytes = "Hello World!!!".getBytes();
server.deactivate();
try {
ictx = doClientInvoke(client, octx, outBytes, true);
len = ictx.getInputStream().read(bytes);
if (len != -1) {
fail("was able to process a message after the servant was deactivated: " + len
+ " - " + new String(bytes));
}
} catch (IOException ex) {
//ignore - this is what we want
}
server.activate(callback);
outBytes = "New String and must match with response".getBytes();
ictx = doClientInvoke(client, octx, outBytes, false);
len = ictx.getInputStream().read(bytes);
assertTrue("Did not read anything " + len, len > 0);
assertEquals(new String(outBytes), new String(bytes, 0, len));
server.shutdown();
client.shutdown();
}