如何通过Sabre Scribe发送Sabre Web Services请求及其他RQ并获取RS
Nice job getting Sabre Profiles working with Scribe and EPS! Sending other RQ requests follows a similar pattern but with a few request-specific tweaks—let’s break this down step by step for PriceItineraryRQ and GetReservationRQ.
First, a quick sanity check: since you already have Profiles working, your EPS credentials, Scribe project setup (endpoint configuration, authentication), and basic request flow should be solid. Just make sure your EPS account has permissions for the new requests you’re trying to send (if you hit auth/permission errors, reach out to Sabre support to enable them).
1. Retrieving a Reservation with GetReservationRQ
This request pulls full details for an existing PNR. Here’s how to implement it in Scribe:
Step 1: Build the Request XML
You’ll need a valid PNR locator and to specify the data you want returned. A minimal example:
<GetReservationRQ Version="2.2.0"> <Locator>ABC123</Locator> <!-- Replace with your target PNR --> <RequestType>State</RequestType> <ReturnOptions> <IncludeDetails>true</IncludeDetails> </ReturnOptions> </GetReservationRQ>
Step 2: Send the Request in Scribe
If you’re using a script component (JavaScript-based), use the EPS ExecuteRequest method:
// Construct the request XML var requestXml = ` <GetReservationRQ Version="2.2.0"> <Locator>ABC123</Locator> <RequestType>State</RequestType> <ReturnOptions> <IncludeDetails>true</IncludeDetails> </ReturnOptions> </GetReservationRQ> `; // Send request via EPS var response = EPS.ExecuteRequest("GetReservationRQ", requestXml); // Parse key data from the response var reservationLocator = response.SelectSingleNode("//GetReservationRS/Reservation/Locator").Text; var passengerFullName = response.SelectSingleNode("//GetReservationRS/Reservation/Passengers/Passenger/Name/GivenName").Text + " " + response.SelectSingleNode("//GetReservationRS/Reservation/Passengers/Passenger/Name/Surname").Text; // Log or use the data LogInfo("Successfully retrieved PNR " + reservationLocator + " for passenger: " + passengerFullName);
Key Notes:
- Use a supported version (2.2.0 is widely compatible; check Sabre docs for the latest).
- If you don’t need full details, set
<IncludeDetails>false</IncludeDetails>to reduce response size. - Add error handling to catch invalid locators or permission issues (more on that later).
2. Pricing an Itinerary with PriceItineraryRQ
This request can reprice an existing PNR or price a new, custom itinerary. We’ll cover the common "reprice existing PNR" use case first.
Step 1: Build the Request XML
A basic reprice request (updates the PNR’s price if Retain="true"):
<PriceItineraryRQ Version="3.1.0"> <PriceRequestInformation> <Retain>true</Retain> <!-- Set to false if you don't want to update the PNR --> <PriceOptions> <Reprice>true</Reprice> </PriceOptions> </PriceRequestInformation> <Locator>ABC123</Locator> <!-- Target PNR --> </PriceItineraryRQ>
Step 2: Send and Parse the Response in Scribe
var requestXml = ` <PriceItineraryRQ Version="3.1.0"> <PriceRequestInformation> <Retain>true</Retain> <PriceOptions> <Reprice>true</Reprice> </PriceOptions> </PriceRequestInformation> <Locator>ABC123</Locator> </PriceItineraryRQ> `; var response = EPS.ExecuteRequest("PriceItineraryRQ", requestXml); // Extract total price details var totalAmount = response.SelectSingleNode("//PriceItineraryRS/PriceItineraryResults/ItineraryPriceDetail/TicketTotal/TotalAmount").Text; var currency = response.SelectSingleNode("//PriceItineraryRS/PriceItineraryResults/ItineraryPriceDetail/TicketTotal/CurrencyCode").Text; LogInfo("Repriced PNR total: " + totalAmount + " " + currency);
Key Notes:
- For custom itineraries (not tied to a PNR), add an
<Itinerary>node with flight segments, passenger details, etc. - Include
<BillingPointOfSaleInfo OriginApplication="SCRIBE"/>if you run into origin validation errors. - Version 3.1.0 is standard for this request; adjust if your EPS environment requires a different version.
General Best Practices for Scribe + EPS
- Error Handling: Always wrap requests in try/catch blocks to handle API errors gracefully:
try { var response = EPS.ExecuteRequest("GetReservationRQ", requestXml); var errorNode = response.SelectSingleNode("//SabreError/ErrorCode"); if (errorNode != null) { throw new Error("Sabre API Error: " + errorNode.Text + " - " + response.SelectSingleNode("//SabreError/ErrorMessage").Text); } // Process valid response } catch (ex) { LogError("Request failed: " + ex.Message); } - Use Pre-built Actions: If you prefer no-code, check Scribe’s Sabre EPS connector for pre-defined actions like "Get Reservation" or "Price Itinerary"—you can just fill in parameters instead of writing XML.
- Validate XML: Ensure your request XML matches Sabre’s XSD schemas (available in the Sabre Developer Portal) to avoid syntax errors.
内容的提问来源于stack exchange,提问作者Xavier

