Connettersi al Web Services di Sabre con Coldfusion (cfhttp)
Web Services di Sabre, sembrava facile agganciarsi e lanciare le varie ricerche per i voli nazionali, internazionali e gli altri servizi, ma solo dopo qualche tentativo ho trovato il comando giusto per coldfusion, cfhttp.
scrivo qui un semplice esempio, una ricerca di un volo Roma - Madrid:
<cfxml variable="SearchCreate">
<cfoutput>
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Header>
<eb:MessageHeader SOAP-ENV:mustUnderstand="1" eb:version="1.0">
<eb:ConversationId>#ConversationId#</eb:ConversationId>
<eb:From>
<eb:PartyId type="urn:x12.org:IO5:01">#FromPartyId#</eb:PartyId>
</eb:From>
<eb:To>
<eb:PartyId type="urn:x12.org:IO5:01">#ToPartyId#</eb:PartyId>
</eb:To>
<eb:CPAId>#organization#</eb:CPAId>
<eb:Service eb:type="OTA">OTA_AirLowFareSearchLLSRQ</eb:Service>
<eb:Action>OTA_AirLowFareSearchLLSRQ</eb:Action>
<eb:MessageData>
<eb:MessageId>10000</eb:MessageId>
<eb:Timestamp>2001-02-15T11:15:12Z</eb:Timestamp>
<eb:TimeToLive>2001-02-15T11:15:12Z</eb:TimeToLive>
</eb:MessageData>
</eb:MessageHeader>
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/12/utility">
<wsse:BinarySecurityToken>#session.SOAPSecurityToken#</wsse:BinarySecurityToken>
</wsse:Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<OTA_AirLowFareSearchRQ xmlns="http://webservices.sabre.com/sabreXML/2003/07" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" EchoToken="String" TimeStamp="2001-12-17T09:30:47-05:00" Target="Production" Version="2003A.TsabreXML1.13.1" SequenceNmbr="1" PrimaryLangID="en-us" AltLangID="en-us">
<POS>
<Source PseudoCityCode="#organization#" />
</POS>
<OriginDestinationInformation RPH="1">
<DepartureDateTime>2013-07-15T10:00:00</DepartureDateTime>
<OriginLocation LocationCode="FCO"/>
<DestinationLocation LocationCode="MAD"/>
<TPA_Extensions>
<AlternateTime PlusMinus="8"/>
</TPA_Extensions>
</OriginDestinationInformation>
<cfif rad01 IS "AR"><!--- se andata e ritorno --->
<OriginDestinationInformation RPH="2">
<DepartureDateTime>2013-07-18T10:00:00</DepartureDateTime>
<OriginLocation LocationCode="MAD"/>
<DestinationLocation LocationCode="FCO"/>
</OriginDestinationInformation>
</cfif><!--- // se andata e ritorno --->
<TravelPreferences MaxStopsQuantity="0">
<CabinPref Code="Y" RPH="1" /><!-- Economy Y -->
<cfif rad01 IS "AR"><CabinPref Code="Y" RPH="2" /></cfif>
<TPA_Extensions>
<NumTrips Number="10" />
</TPA_Extensions>
</TravelPreferences>
<TravelerInformation>
<PassengerTypeQuantity Code="ADT" Quantity="2"/>
</TravelerInformation>
<PriceRequestInformation CurrencyCode="EUR">
<TPA_Extensions>
<FareCalc Ind="true"/>
<Priority>
<Price Priority="3" />
<DirectFlights Priority="2" />
<Time Priority="1" />
<Vendor Priority="4" />
</Priority>
</TPA_Extensions>
</PriceRequestInformation>
</OTA_AirLowFareSearchRQ>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
</cfoutput>
</cfxml>
<cfhttp url="#WSDL#" method="post" resolveurl="no" timeout="200">
<cfhttpparam type="header" name="header" value="">
<cfhttpparam type="xml" name="body" value="#SearchCreate#">
</cfhttp>
<cfset SearchResponse = XMLParse(cfhttp.FileContent)>
<cfdump var="#SearchResponse #" expand="no" label="Click here to maximize 'soap_login_response'">
<cfoutput>
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Header>
<eb:MessageHeader SOAP-ENV:mustUnderstand="1" eb:version="1.0">
<eb:ConversationId>#ConversationId#</eb:ConversationId>
<eb:From>
<eb:PartyId type="urn:x12.org:IO5:01">#FromPartyId#</eb:PartyId>
</eb:From>
<eb:To>
<eb:PartyId type="urn:x12.org:IO5:01">#ToPartyId#</eb:PartyId>
</eb:To>
<eb:CPAId>#organization#</eb:CPAId>
<eb:Service eb:type="OTA">OTA_AirLowFareSearchLLSRQ</eb:Service>
<eb:Action>OTA_AirLowFareSearchLLSRQ</eb:Action>
<eb:MessageData>
<eb:MessageId>10000</eb:MessageId>
<eb:Timestamp>2001-02-15T11:15:12Z</eb:Timestamp>
<eb:TimeToLive>2001-02-15T11:15:12Z</eb:TimeToLive>
</eb:MessageData>
</eb:MessageHeader>
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/12/utility">
<wsse:BinarySecurityToken>#session.SOAPSecurityToken#</wsse:BinarySecurityToken>
</wsse:Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<OTA_AirLowFareSearchRQ xmlns="http://webservices.sabre.com/sabreXML/2003/07" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" EchoToken="String" TimeStamp="2001-12-17T09:30:47-05:00" Target="Production" Version="2003A.TsabreXML1.13.1" SequenceNmbr="1" PrimaryLangID="en-us" AltLangID="en-us">
<POS>
<Source PseudoCityCode="#organization#" />
</POS>
<OriginDestinationInformation RPH="1">
<DepartureDateTime>2013-07-15T10:00:00</DepartureDateTime>
<OriginLocation LocationCode="FCO"/>
<DestinationLocation LocationCode="MAD"/>
<TPA_Extensions>
<AlternateTime PlusMinus="8"/>
</TPA_Extensions>
</OriginDestinationInformation>
<cfif rad01 IS "AR"><!--- se andata e ritorno --->
<OriginDestinationInformation RPH="2">
<DepartureDateTime>2013-07-18T10:00:00</DepartureDateTime>
<OriginLocation LocationCode="MAD"/>
<DestinationLocation LocationCode="FCO"/>
</OriginDestinationInformation>
</cfif><!--- // se andata e ritorno --->
<TravelPreferences MaxStopsQuantity="0">
<CabinPref Code="Y" RPH="1" /><!-- Economy Y -->
<cfif rad01 IS "AR"><CabinPref Code="Y" RPH="2" /></cfif>
<TPA_Extensions>
<NumTrips Number="10" />
</TPA_Extensions>
</TravelPreferences>
<TravelerInformation>
<PassengerTypeQuantity Code="ADT" Quantity="2"/>
</TravelerInformation>
<PriceRequestInformation CurrencyCode="EUR">
<TPA_Extensions>
<FareCalc Ind="true"/>
<Priority>
<Price Priority="3" />
<DirectFlights Priority="2" />
<Time Priority="1" />
<Vendor Priority="4" />
</Priority>
</TPA_Extensions>
</PriceRequestInformation>
</OTA_AirLowFareSearchRQ>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
</cfoutput>
</cfxml>
<cfhttp url="#WSDL#" method="post" resolveurl="no" timeout="200">
<cfhttpparam type="header" name="header" value="">
<cfhttpparam type="xml" name="body" value="#SearchCreate#">
</cfhttp>
<cfset SearchResponse = XMLParse(cfhttp.FileContent)>
<cfdump var="#SearchResponse #" expand="no" label="Click here to maximize 'soap_login_response'">