Skip Navigation

Sample Code for Host Communications Services

Host Service Client

The following code sample shows how to send and receive a response from the host and use a locked session.

Usage

    String command = "1LASLAX";
    ISRWCommunication com = Activator.getDefault().getServiceReference(ISRWCommunication.class);

    ClientResponse <HostResponse> rsp = new HostServiceClient(com).send(new HostCommand(command));
    if (rsp.isSuccess())
    {
        showMessage(rsp.getPayload().getText());
    }

AggregatedResponseHostConnector

Aggregated Response Host Connector service - allows to communicate with host sending commands that have multiple responses.

Usage

    String response = "";
    String command = "CFLAX/15FEB-20FEB/1P-1P/ECAR/ID-ZI1456D,ET564389";
    ISRWCommunication com = Activator.getDefault().getServiceReference(ISRWCommunication.class);

    ClientResponse <AggregatedHostResponse> rsp =
                new AggregatedResponseHostServiceClient(COM).send(new HostCommand(command));

    if (rsp.isSuccess())
    {
       for (HostResponse hostResponse: rsp.getPayload().getResponses()) {
          response = response.concat(hostResponse.getText());
        }
    }