Skip Navigation

Sending Requests to SRWRuntime for Sabre Emulator Services

To send requests to SRWRuntime for Sabre Emulator Services, you need a working Red App project with an Activator class.

  1. Using Eclipse, add the following required dependencies to your plug-in project:

    • com.sabre.edge.cf.core

    • com.sabre.edge.cf.model

    • com.sabre.edge.cf.emu

    • com.sabre.edge.platform.core.common

  1. Add the following Java code to consume this service.

  1. Obtain a reference to ISRWCommunication service:

ISRWCommunication com = Activator.getDefault().getServiceReference(ISRWCommunication.class);
  1. Create an instance of ShowInEmuServiceClient class and call send() method with an instance of EmulatorCommand class.

ShowInEmuServiceClient showClient = new ShowInEmuServiceClient(com);
String command = "1LASLAX";
boolean isCommand = true;

EmulatorCommand cmd = new EmulatorCommand(command);
cmd.setIsCommand(isCommand));
EmulatorCommandRequest request = new EmulatorCommandRequest(cmd);
showClient.send(request);

                              Or similar for ExecuteInEmuServiceClient:

ExecuteInEmuServiceClient executeClient = new ExecuteInEmuServiceClient(com);
String command = "1LASLAX";
boolean showCommand = true;
boolean showResponse = true;

EmulatorCommand cmd = new EmulatorCommand(command);
cmd.setShowCommand(showCommand);
cmd.setShowResponse(showResponse);
EmulatorCommandRequest request = new EmulatorCommandRequest(cmd);
executeClient.send(request);

 

  1. Retrieve a response to ClientResponse<EmulatorResponse> reference.    This class provides simple methods isSuccess() to check for status,    getErrors() retrieving errors (if occurred). The method getPayload() will always return null as this service does not return any response.

if (rsp.isSuccess())
{
    // do something on success
}
  1. Create your redapp.xml configuration file, and add an Authorization entry to the file to use the ShowInEmulator or ExecuteInEmulator service.