Issue ticket from Sabre API - sabre

I am trying to implement an application to book flights using Sabre API. I have successfully created the PNR and am moving towards issuing tickets. I followed the listed workflow to book and issue ticket.
BargainFinderMaxRQ to find the flights
PassengerDetailsRQ to generate PNR
EnhancedAirBookRQ to book the flight segment
To issue ticket I am following this workflow:
TravelItineraryReadRQ to get PNR
DesignatePrinterLLSRQ to designate a printer(Even though i do not want to designate a printer as I only require e-tickets)
AirTicketLLSRQ to issue tickets
EndTransactionLLSRQ to end the transaction and send email
I am stuck for a couple of days in issuing the ticket and have been working a lot to overcome but through one or more steps I somehow do get stuck somewhere. Right now I am stuck at DesignatePrinterLLSRQ which says ERR.SWS.CLIENT.VALIDATION_FAILED.
Attached are my xml logs:
Request Body:
<SOAP-ENV:Body>
<DesignatePrinterRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0.1">
<Printers>
<BagTag LNIATA=""/>
</Printers>
</DesignatePrinterRQ>
<DesignatePrinterRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0.1">
<Printers>
<BagTag Undesignate="true"/>
</Printers>
</DesignatePrinterRQ>
</SOAP-ENV:Body>
Response:
<soap-env:Body>
<soap-env:Fault>
<faultcode>soap-env:Client.Validation</faultcode>
<faultstring>ERR.SWS.CLIENT.VALIDATION_FAILED</faultstring>
<detail>
<stl:ApplicationResults xmlns:stl="http://services.sabre.com/STL/v01" status="NotProcessed">
<stl:Error timeStamp="2017-02-10T02:35:51-06:00" type="Validation">
<stl:SystemSpecificResults>
<stl:Message>Request resulted in empty Host Command</stl:Message>
<stl:ShortText>ERR.SWS.CLIENT.VALIDATION_FAILED</stl:ShortText>
</stl:SystemSpecificResults>
</stl:Error>
</stl:ApplicationResults>
</detail>
</soap-env:Fault>
</soap-env:Body>
If it is possible, do let me know if there is an issue with my workflow.
Regards

There is one important error and even if you are not getting the same error anymore it is important to highlight.
In your request, you attempting to call the service more than once and that is not correct. You are opening the DesignatePrinterRQ tag twice and that will not work, because after closing the first DesignatePrinter nothing else is expected.
Below is your request:
<SOAP-ENV:Body>
<DesignatePrinterRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0.1">
<Printers>
<BagTag LNIATA=""/>
</Printers>
</DesignatePrinterRQ>
<DesignatePrinterRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0.1">
<Printers>
<BagTag Undesignate="true"/>
</Printers>
</DesignatePrinterRQ>
</SOAP-ENV:Body>
Below is how it should be:
<SOAP-ENV:Body>
<DesignatePrinterRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0.1">
<Printers>
<BagTag LNIATA=""/>
</Printers>
</DesignatePrinterRQ>
</SOAP-ENV:Body>
--
Now, I am not sure for which kind of customer you are developing but BagTag printer is only meant for airlines to use, not travel agencies. You will just need to send something like this before issuing the ticket:
<SOAP-ENV:Body>
<DesignatePrinterRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0.1">
<Printers>
<Ticket CountryCode="AT">
</Printers>
</DesignatePrinterRQ>
</SOAP-ENV:Body>
In order to check which CountryCode should you use, please check on the
Format Finder. (You should be able to use the same credentials you use for creating sessions)
If, at the time of issuing the ticket you get something like Designate HardCopy printer, get in touch with Sabre for them to try and disable the hardcopy printing.

Sabre has the concept of virtual printers, which are not physical printers and are suitable for cases like this, where you don't want something to be actually printed. You need to get sabre to configure virtual printers and give you the line addresses for them.
Your workflow for ticketing should be...
Get a sabre session
Designate a printer. You may need to change your duty code to 4 or 5 before this otherwise printer designation can fail.
Call AirTicket
EndTransaction
Make sure your itinerary is quoted before issuing a ticket.
When designating a printer, you need to specify the country code and the line address. Some code I use for doing this is below...
// Assign a printer
DesignatePrinterRQ designatePrinterRQ = new DesignatePrinterRQ();
designatePrinterRQ.setVersion("2003A.TsabreXML1.2.1");
Printers printers = new Printers();
designatePrinterRQ.setPrinters(printers);
Ticket ticketPrinter = new Ticket();
printers.setTicket(ticketPrinter);
ticketPrinter.setCountryCode("2A");
ticketPrinter.setLineAddress("99999901234540");
In the above code, 999999 is a virtual printer and 01234540 is the station code of the sabre session.

Related

Send username/password to SOAP Service

I created a WDSL API-Proxy, everything works find but as expected i'm receiving an Authentication error because i'm not sending the correct user and password to the SOAP server, where do i set that?
Maybe you need pass username and password in header request.
Typical you will include an Authorization header for a SOAP call. I typically do these in an assign message policy like the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<AssignMessage name="buildSoapMessage">
<DisplayName>buildSoapMessage</DisplayName>
<AssignTo createNew="true" type="request">request</AssignTo>
<Set>
<Headers>
<Header name="Authorization">{request.header.Authorization}</Header>
</Headers>
<Verb>POST</Verb>
<Payload contentType="text/xml">
<Request xmlns="urn:foo:bar:1.0">

How to Query the APIGee Cache

My Question: How can i query/list the contents of the cache.
So i have creates one cache from Management API->Environment Configuration.
Then i created a api proxy with no target and attached populate cache policy to it. e.g.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PopulateCache async="false" continueOnError="false" enabled="true" name="populateBlacklistByIP">
<DisplayName>populateBlacklistByIP</DisplayName>
<FaultRules/>
<Properties/>
<CacheKey>
<Prefix>CLIENTIP-</Prefix>
<KeyFragment ref='request.queryparam.myvar'/>
</CacheKey>
<CacheResource>mycache</CacheResource>
<Scope>Global</Scope>
<!-- no expiry -->
<ExpirySettings>
<TimeoutInSec>432000</TimeoutInSec>
</ExpirySettings>
<Source>request.queryparam.myvar</Source>
</PopulateCache>
Now i invoke the operation and get 200 ok back. But no way to check if the value made to cache or not.
Please help.
Got My Answer from digging through the documentation.
Ref: http://apigee.com/docs/api-services/content/persistence.
Read this from url above:
Cache versus Key/value map
The PopulateCache policy does not persist cache entries. Entries are in memory until the configured expiration time. You can look up the value only until it expires.
One limitation is that you cannot find the list of keys that are currently in a cache.
When using KeyValueMap, the keys are persisted indefinitely. There are APIs available to retrieve the list of keys. There is no expiration time for the keys; you must explicitly delete them.

Differences in validating APIKeys with GetOAuthV1Info and VerifyAPIKey

We are in the process of totally rewriting our main API Proxy config and we discovered an issue with our new configuration (or maybe our existing one) relating to how API keys are being validated. Our current API uses the policy GetOAuthV1Info
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<GetOAuthV1Info enabled="true" continueOnError="false" async="false" name="APIKey-Validate">
<DisplayName>APIKey-Validate</DisplayName>
<FaultRules/>
<Properties/>
<AppKey ref="request.queryparam.apikey"></AppKey>
</GetOAuthV1Info>
Our new configuration uses the policy VerifyAPIKey
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<VerifyAPIKey async="false" continueOnError="false" enabled="true" name="Verify-Api-Key">
<DisplayName>Verify API Key</DisplayName>
<APIKey ref="request.queryparam.apikey"/>
</VerifyAPIKey>
On the surface both of these policies appear to work fine. However, after deploying the new config to our test environment some API keys were failing with a 401 Unauthorized error. Digging into those keys we discovered that they are assigned to a product that doesn't have access to the test environment. It appears that the GetOAuthV1Info step is not validating the environment..? The documentation for GetOAuthV1Info doesn't help as it doesn't talk about APIKeys at all (http://apigee.com/docs/api-services/content/authorize-requests-using-oauth-10a).
Fixing this particular issue is pretty straight forward in that we just need to allow those other products access to the test environment. However, this makes me wonder what the other differences are between these two policies? I'm very nervous now about deploying any changes to these API proxies because I don't know what else will break, or what other unforeseen issues will appear.
Is this a known limitation with the GetOAuthV1Info policy? Why does this even work at all? What are the other differences between these two policies that might bite me later?
The only difference that I'm aware of is that the variable names are assigned differently in the VerifyAPIKey Policy (it appends the policy type and name to the vairalbes like verifyapikey.verify_apikey-1.apiproduct.developer.quota.limit for example).
Both VerifyAPIKey and OAuth 1 does support restrictions by environment -- when I tested the GetOAuthV1 with an APIKey in an invalid environment and got this error:
OAuth Failure : Invalid API call as no apiproduct match found
Keep in mind that the convention for most projects seems to be either OAuth2 flows or the VerifyAPI so there is less information about the OAuth1 policies.

Apigee: Using environment name to extract variable

I have set up a custom variable in my developer app called sandbox.app_id so I can have different ids for different applications.
I am using the verify api key policy and this populate the verifyapikey.* variables.
I want an ExtractVariable policy similar to below:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="Extract-TLRG-App-ID">
<DisplayName>Extract TLRG App ID</DisplayName>
<FaultRules/>
<Properties/>
<Variable name="app_id">verifyapikey.verify-api-key.{environment.name}.app_id</Variable>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<VariablePrefix>apigee</VariablePrefix>
</ExtractVariables>
Is this possible, or will I have to resort to javascript?
Basically you are trying to access custom application attributes from your extract variable policy. So you need to place this extract variable policy after your verify api key policy. A verify api key policy would load all the application attributes as flow variables for a valid key. You may not see the custom attributes as variables in the debug view. However correct way to access the variables is to use this naming format below:
verifyapikey.{your_policy_name}.app.{custom_attribute_name}
Note that the verify api key policy is mandatory, otherwise the application associated with the API call can not be identified.

Problems with Spring Integration HTTP outbound channel adapter

I am using spring integration 2.2.4 and am trying to add HTTP outbound channel adapter for invoking GET/POST REST services. Currently the adapter is getting displayed in the graph view but when I am trying to drag and use it in the code , it is not getting created.
I have added the HTTP namespaces URI as required.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http="http://www.springframework.org/schema/integration/http"
xmlns:int="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/http
http://www.springframework.org/schema/integration/http/spring-integration-http.xsd">
<http:outbound-channel-adapter channel=""/>
If I am trying to add this manually in the source XML then I am getting error as "The matching wildcard is strict , but no declaration could be found for element http:outbound-channel-adapter"
Can anyone help me out here with a sample http-outbound channel adapter? Am I missing something here.

Resources