Skip to main content

com.sabre.edge.example.cf.rest2sg Sample

The com.sabre.redapp.example.cf.rest2sg sample demonstrates sending and wrapping a REST request using the Sabre Web Services communications service. It locks the session while the service is running with the com.sabre.edge.cf.host.Locking (locking) service.

The following describes the files that this sample includes:

  • Activator.java gets an instance of SRWRuntime and uses tokenService to request the authentication token.

  • Rest2SgView.java builds a view to demonstrate using the Sabre Web Services service to send a request for geolocation. The Sabre Web Services action code for geolocation requests is passed.

Methods in this class lock the TA session while the Rest 2SG communications service is running, and these methods unlock the session when the service is done. Additionally, this code gets a parser.

  • redapp.xml requests authorization to use the Sabre Web Services locking communications services.

Running the Sample

  1. In Eclipse, import the com.sabre.redapp.example.cf.rest2sg plug-in into your workspace and add it to your run configuration.

  2. Launch Sabre Red 360 from your run configuration and log in with your CERT Sabre ID.

  3. Log in to the Sabre host using Sabre emulator.

  4. From Tools > Other on the launcher bar, open Rest2SG View.

  5. Click Lock, and then click Send Rest2Sg Request several times. The request is sent to Sabre Web Services.

  6. Wait several seconds to see the response payload from Sabre Web Services, as JSON. Click Unlock.

The following figure shows the response payload.

sample 2sgrest