Skip Navigation

Sample Code for Accessing Web Services with SOAP

Sample Java code that shows a complete Sabre Web Services request in a plug-in follows.

// Set actionName to the correct Sabre Web Services action name
String actionName = "OTA_AirAvailLLSRQ";

// Retrieve a reference to ISRWCommunication
ISRWCommunication com = Activator.getDefault().getServiceReference(ISRWCommunication.class);

// Create the request
SWSRequest request = new SWSRequest();
request.setAction(actionName);
request.setPayload(payload);

// Send the request
SWSServiceClient client = new SWSServiceClient(com);
ClientResponse <SWSResponse> rsp = client.send(request);
// Retrieve the response
if (rsp.isSuccess()) {
SWSResponse response = rsp.getPayload();
// Response for the sent request
      Document responsePayload = response.getResponse();
}