Мастер-Web:Дополнительный модуль Сервис TourML Приложение B
Статья находится на стадии разработки.
Версия статьи от 11-07-2017.
Введение
Эта статья является приложением B к статье Дополнительный модуль Сервис TourML. В ней рассказывается о функциях проверки бронирования и функциях бронирования в веб-сервисе TourML.
Функция CheckBooking
Ниже представлен пример запроса на проверку возможности бронирования.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://tourml.ru/service/2004-08-13/products" xmlns:ns="http://tourml.ru/bookings/2004-09-28" xmlns:ns1="http://tourml.ru/products/2004-04-19" xmlns:ext="http://www.megatec.ru/tourml/extensions">
<soapenv:Header/>
<soapenv:Body>
<prod:CheckBooking>
<!--Optional:-->
<bookings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tourml.ru/bookings/2004-09-28" version="1.0" date="2006-07-11" time="16:18:43.7311809+04:00" uri="http://www.ESystema.ru">
<booking>
<header id="10760" checkin="2017-07-11" buyerPerson="1" mainPerson="1" agreementKey="40224">
<comment>Данная заявка выполнена для проверки работы сервиса. Саму заявку в работу отправлять не нужно</comment>
</header>
<packets>
<packet id="_192">
<calculated key="31016" />
</packet>
</packets>
<persons>
<person key="1" sourceKey="0" packets="_192" firstNameRus="TEST" lastNameRus="TEST" firstNameLat="TEST" lastNameLat="TEST" sex="male" birthday="1982-03-03" nationalityRus="" nationalityLat="" isTourist="true">
<contacts>
<phones />
<addresses />
<emails />
</contacts>
<passports>
<passport type="foreign" series="1111" number="111111111" emittedBy="ОВД" emittedWhen="1990-01-01" validTo="2020-03-03" />
</passports>
</person>
<person key="2" sourceKey="0" packets="_192" firstNameRus="TEST" lastNameRus="TEST" firstNameLat="TEST" lastNameLat="TEST" sex="male" birthday="1982-02-02" nationalityRus="" nationalityLat="" isTourist="true">
<contacts>
<phones />
<addresses />
<emails />
</contacts>
<passports>
<passport type="foreign" series="1111" number="111111111" emittedBy="ОВД" emittedWhen="1990-01-01" validTo="2020-02-02" />
</passports>
</person>
</persons>
</booking>
</bookings>
</prod:CheckBooking>
</soapenv:Body>
</soapenv:Envelope>
|
В ответ на проверку бронирования возвращается результат проверки в виде XML-документа. Ниже представлен пример возвращаемого XML-документа.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns="http://tourml.ru/products/2004-04-19">
<soap:Header>
<wsa:Action>http://tourml.ru/service/2004-08-13/products/CheckBookingResponse</wsa:Action>
<wsa:MessageID>uuid:89e8d325-c85b-42af-99c1-ecf8d45aee29</wsa:MessageID>
<wsa:RelatesTo>uuid:3cc31840-1e23-4349-87dd-b19b24ca3d4f</wsa:RelatesTo>
<wsa:To>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:To>
<wsse:Security>
<wsu:Timestamp wsu:Id="Timestamp-52dc5ad0-e53d-444e-ba86-5f64dcd864b9">
<wsu:Created>2017-07-11T09:40:03Z</wsu:Created>
<wsu:Expires>2017-07-11T09:45:03Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body>
<CheckBookingResponse xmlns="http://tourml.ru/service/2004-08-13/products">
<CheckBookingResult date="0001-01-01" time="00:00:00.0000000+03:00" xmlns="http://tourml.ru/bookings/2004-09-28">
<agreement>
<header uri="" checkin="2017-07-11" buyerPerson="1" mainPerson="1" agreementKey="-10" agreementCode="-10" country="Бельгия" city="Брюссель" days="15" quantity="2" price="1180" pricePaid="0" currency="EU" creationDate="2017-07-11" payUntil="0001-01-01" status="ok" errorStatus="unknown" commission="0">
<comment/>
</header>
<packets>
<packet id="_1">
<services>
<hotelServices>
<hotelService key="1487" keytype="3231|1116|10|191|10763|3|63|3|192|159" name="HOTEL::Брюссель/Zeebrugge-4*,14 ночей/2A(Standart),2A/RO Не предоставляется/" dayBeg="1" nights="14" days="15" men="2" reasonRus="Места по запросу" reasonLat="Places by request" serviceCategory="required" chosen="true" placeStatus="byRequest" serviceStatus="waitlist" sourceKey="0" buildingKey="3231" roomKey="1116" mealKey="10" infantsOnExtraBedCount="0" infantsOnMainBedCount="0" maxInfantsCount="0" maxInfantsOnMainBedCount="0"/>
</hotelServices>
<flightServices>
<flightService key="1001" keytype="525|89|1|191|10763|1|63|3|192|31" name="А_П::Москва/Брюссель/LH069, DME-BRU, 06:10-09:15/Y Экономический класс/" dayBeg="1" nights="0" days="0" men="2" reasonRus="Места по запросу" reasonLat="Places by request" serviceCategory="replaceable" chosen="true" serviceClass="1" serviceSet="1" placeStatus="byRequest" serviceStatus="waitlist" sourceKey="0" flightKey="525" tariffKey="89" infantsOnIndividualPlaceCount="0" infantsWithoutPlaceCount="0" maxInfantsCount="0" maxInfantsOnIndividualPlaceCount="0"/>
<flightService key="1002" keytype="524|89|63|191|10763|1|1|460|192|31" name="А_П::Брюссель/Москва/LH068, BRU-DME, 07:05-10:10/Y Экономический класс/" dayBeg="15" nights="0" days="0" men="2" reasonRus="Места по запросу" reasonLat="Places by request" serviceCategory="replaceable" chosen="true" serviceClass="1" serviceSet="1" placeStatus="byRequest" serviceStatus="waitlist" sourceKey="0" flightKey="524" tariffKey="89" infantsOnIndividualPlaceCount="0" infantsWithoutPlaceCount="0" maxInfantsCount="0" maxInfantsOnIndividualPlaceCount="0"/>
</flightServices>
<excursionServices>
<excursionService key="1490" keytype="94|3|0|191|10764|4|63|3|192|0" name="Экскурсия::Брюссель/Обзорная по Брюсселю, /автобус /" dayBeg="15" nights="0" days="0" men="2" reasonRus="Места есть" reasonLat="Places available" serviceCategory="required" chosen="true" placeStatus="present" serviceStatus="ok" sourceKey="0" excursionKey="94" transportKey="3"/>
</excursionServices>
<transferServices/>
<cruiseServices/>
<extraServices/>
</services>
<inline>
<TourML version="1.0" date="2017-07-11" time="12:40:03">
<header name="Фирма-владелец" uri="" vendor="Megatec" xmlns="http://tourml.ru/products/2004-04-19"/>
<references xmlns="http://tourml.ru/products/2004-04-19">
<countries>
<country key="460" name="Россия" nameLat="Russia"/>
<country key="3" name="Бельгия" nameLat="Belgium"/>
</countries>
<resorts/>
<cities>
<city key="1" name="Москва" nameLat="Moscow" code="MOW" countryKey="460"/>
<city key="63" name="Брюссель" nameLat="en_Брюссель" code="BRU" countryKey="3"/>
</cities>
<categories>
<category key="707724292" name="4*" nameLat="4*"/>
</categories>
<hotels>
<hotel key="3231" name="Zeebrugge" nameLat="Zeebrugge" code="zee" countryKey="3" cityKey="63"/>
</hotels>
<buildings>
<building key="3231" name="Основной корпус" nameLat="Base build" categoryKey="707724292" hotelKey="3231"/>
</buildings>
<airlines>
<airline key="18" name="Lufthunsa" nameLat="en_Lufthunsa" code="LH"/>
</airlines>
<airports>
<airport key="64" name="BRU" nameLat="BRU" code="BRU" cityKey="63" distance="0"/>
<airport key="12" name="Домодедово" nameLat="Домодедово" code="DME" cityKey="1" distance="0"/>
</airports>
<aircrafts>
<aircraft key="4" name="aerobus A-310" nameLat="aerobus A-310" code="310"/>
</aircrafts>
<flights>
<flight key="525" code="069" fromCityKey="1" toCityKey="63" airlineKey="18">
<flightTime key="1" fromAirportKey="12" toAirportKey="64" dateBegin="2012-01-01" dateEnd="2021-01-01" weekDays="1234567" aircraftKey="4" timeBegin="06:10:00" timeEnd="09:15:00"/>
</flight>
<flight key="524" code="068" fromCityKey="63" toCityKey="1" airlineKey="18">
<flightTime key="2" fromAirportKey="64" toAirportKey="12" dateBegin="2012-01-01" dateEnd="2021-01-01" weekDays="1234567" aircraftKey="4" timeBegin="07:05:00" timeEnd="10:10:00"/>
</flight>
</flights>
<roomTypes>
<roomType key="38" name="2A" nameLat="2A" code="2A" numBed="2" numExBed="0"/>
</roomTypes>
<roomLocations/>
<roomViews/>
<roomCategories>
<roomCategory key="20" name="Standart" nameLat="Standart" code="STD"/>
</roomCategories>
<roomDescriptions>
<roomDescription key="20" catKey="20"/>
</roomDescriptions>
<roomAccomodations>
<roomAccomodation key="325" name="2A" nameLat="2A" code="2A" numBed="2">
<adult place="0" order="0"/>
<adult place="0" order="0"/>
</roomAccomodation>
</roomAccomodations>
<rooms>
<room key="1116" typeKey="38" roomDescKey="20" accomodationKey="325"/>
</rooms>
<serviceClasses>
<serviceClass key="3" stdKey="hotel " name="Отель/Круиз" nameLat="Hotel/Cruise" isCity="true" isSubKey="true" isSubKey1="true" isSubKey2="true"/>
</serviceClasses>
<serviceDescriptions/>
<serviceDescriptions1/>
<serviceDescriptions2/>
<transfers/>
<excursions>
<excursion key="94" name="Обзорная по Брюсселю" nameLat="en_Обзорная по Брюсселю" duration="" placeFrom="" placeTo="" cityKey="63" timeBegin="00:00:00" timeEnd="00:00:00"/>
</excursions>
<transports>
<transport key="3" name="автобус" nameLat="BUS" places="0"/>
</transports>
<cabines/>
<ships/>
<boardings/>
<currencies>
<currency key="2" name="Euro" nameLat="Euro" code="EU"/>
</currencies>
<tariffs>
<tariff key="89" name="Экономический класс" nameLat="Coach economy" code="Y"/>
</tariffs>
<tourTypes>
<tourType key="2" name="Стандартный тур" nameLat="en_Стандартный тур"/>
</tourTypes>
</references>
<sources xmlns="http://tourml.ru/products/2004-04-19">
<source name="Фирма-владелец" uri="http://">
<packets>
<packet>
<packetHeader>
<tour key="192" name="Тур в Брюссель № 42" tourTypeKey="2" countryKey="3"/>
<spo key="192" for="byPerson" validFrom="2017-07-11" validTo="2017-07-25" currencyKey="2" state="Created" issue="0001-01-01T00:00:00.0000000+03:00">
<calculatingKeys/>
<dates>
<date>2017-07-11T00:00:00</date>
</dates>
<comment/>
</spo>
</packetHeader>
<services>
<hotelServices>
<hotelService mealKey="10" roomKey="1116" buildingKey="3231">
<variant providerKey="0" dayBeg="1" nights="14" days="15" men="2" id="_1487">
<info>
<additionalAttributes d19p1:status="Заказ на бронирование" xmlns:d19p1="http://tourml.ru/products/2004-04-19" xmlns="http://www.megatec.ru/tourml/extensions"/>
</info>
</variant>
</hotelService>
</hotelServices>
<flightServices>
<flightService tariffKey="89" flightKey="525">
<variant providerKey="0" dayBeg="1" nights="0" days="0" men="2" id="_1488">
<info>
<additionalAttributes d19p1:status="Заказ на бронирование" xmlns:d19p1="http://tourml.ru/products/2004-04-19" xmlns="http://www.megatec.ru/tourml/extensions"/>
</info>
</variant>
</flightService>
<flightService tariffKey="89" flightKey="524">
<variant providerKey="0" dayBeg="15" nights="0" days="0" men="2" id="_1489">
<info>
<additionalAttributes d19p1:status="Заказ на бронирование" xmlns:d19p1="http://tourml.ru/products/2004-04-19" xmlns="http://www.megatec.ru/tourml/extensions"/>
</info>
</variant>
</flightService>
</flightServices>
<excursionServices>
<excursionService transportKey="3" excursionKey="94">
<variant providerKey="0" dayBeg="15" nights="0" days="0" men="2" id="_1490">
<info>
<additionalAttributes d19p1:status="Ok" xmlns:d19p1="http://tourml.ru/products/2004-04-19" xmlns="http://www.megatec.ru/tourml/extensions"/>
</info>
</variant>
</excursionService>
</excursionServices>
<transferServices/>
<cruiseServices/>
<extraServices/>
</services>
<prices>
<serviceSet ids="_1487 _1488 _1489 _1490">
<price gross="1180">
<date key="-10" from="2017-07-11" to="0001-01-01"/>
</price>
</serviceSet>
</prices>
</packet>
</packets>
</source>
</sources>
</TourML>
</inline>
</packet>
</packets>
<persons>
<person key="-10" sourceKey="-10" packets="_1" services="" firstNameRus="TEST" lastNameRus="TEST" firstNameLat="TEST" lastNameLat="TEST" sex="male" birthday="1982-03-03" nationalityRus="" nationalityLat="" isTourist="true">
<contacts>
<phones>
<phone/>
</phones>
<addresses>
<address postalIndex="" city="" street="" building="" flat=""/>
</addresses>
</contacts>
<passports>
<passport type="foreign" series="1111" number="111111111" emittedBy="ОВД" emittedWhen="1990-01-01" validTo="2020-03-03"/>
<passport type="national" number="" emittedBy="" emittedWhen="0001-01-01" validTo="0001-01-01"/>
</passports>
</person>
<person key="-11" sourceKey="-11" packets="_1" services="" firstNameRus="TEST" lastNameRus="TEST" firstNameLat="TEST" lastNameLat="TEST" sex="male" birthday="1982-02-02" nationalityRus="" nationalityLat="" isTourist="true">
<contacts>
<phones>
<phone/>
</phones>
<addresses>
<address postalIndex="" city="" street="" building="" flat=""/>
</addresses>
</contacts>
<passports>
<passport type="foreign" series="1111" number="111111111" emittedBy="ОВД" emittedWhen="1990-01-01" validTo="2020-02-02"/>
<passport type="national" number="" emittedBy="" emittedWhen="0001-01-01" validTo="0001-01-01"/>
</passports>
</person>
</persons>
<penaltyConditions amount="0.0" currency="" percentage="0" dateLimit="0001-01-01" timeLimit="00:00:00.0000000+03:00"/>
</agreement>
</CheckBookingResult>
</CheckBookingResponse>
</soap:Body>
</soap:Envelope>
|
Функция CreateBooking
Ниже представлен пример запроса на бронирование.
<?xml version="1.0" ?>
<bookings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" date="2006-07-11" time="16:18:43.7311809+04:00" uri="http://www.ESystema.ru">
<booking xmlns="http://tourml.ru/bookings/2004-09-28">
<header id="10795" checkin="2009-09-04" buyerPerson="1" mainPerson="1" agreementKey="0">
<comment>Данная заявка выполнена для проверки работы сервиса. Саму заявку в работу оправлять не нужно</comment>
</header>
<packets>
<packet id="_1">
<calculated key="3203315" />
</packet>
</packets>
<persons>
<person key="1" sourceKey="0" packets="_1" firstNameRus="TEST" lastNameRus="TEST" firstNameLat="TEST" lastNameLat="TEST" sex="male" birthday="1982-03-03" nationalityRus="" nationalityLat="" isTourist="true">
<contacts>
<phones />
<addresses />
<emails />
</contacts>
<passports>
<passport type="foreign" series="1111" number="111111111" emittedBy="ОВД" emittedWhen="1990-01-01" validTo="2007-03-03" />
</passports>
</person>
<person key="2" sourceKey="0" packets="_1" firstNameRus="TEST" lastNameRus="TEST" firstNameLat="TEST" lastNameLat="TEST" sex="male" birthday="1982-02-02" nationalityRus="" nationalityLat="" isTourist="true">
<contacts>
<phones />
<addresses />
<emails />
</contacts>
<passports>
<passport type="foreign" series="1111" number="111111111" emittedBy="ОВД" emittedWhen="1990-01-01" validTo="2007-02-02" />
</passports>
</person>
</persons>
</booking>
</bookings>
|
В ответ на бронирование возвращается результат бронирования – путевка - в виде XML-документа. Ниже представлен пример возвращаемого XML-документа. Все ключи услуг и туристов реальные, полученные из базы данных.
<?xml version="1.0" ?>
<agreements xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" date="0001-01-01" time="00:00:00.0000000+04:00">
<agreement xmlns="http://tourml.ru/bookings/2004-09-28">
<header uri="" checkin="2009-09-04" buyerPerson="0" mainPerson="92470" agreementKey="43037" agreementCode="TR 0904001" country="Турция" city="АНТАЛИЯ" days="8" quantity="2" price="69939.01" pricePaid="0" currency="рб" creationDate="2009-08-04" payUntil="2009-08-05" status="ok" errorStatus="unknown" commission="699.39">
<comment />
</header>
<packets>
<packet id="_1">
<services>
<hotelServices>
<hotelService key="220699" name="HOTEL::АНТАЛИЯ/_NO_CENDER-4*,7 ночей/Double(Standart),Взр./AI Всё включено/" dayBeg="1" nights="7" days="7" men="2" reasonRus="Ok" reasonLat="Ok" sourceKey="0" buildingKey="1037" roomKey="1113" mealKey="38" />
</hotelServices>
<flightServices>
<flightService key="220698" name="А_П::Москва/АНТАЛИЯ/P76523, SVO2-AYT, 18:40-20:20/Y Экономический класс/" dayBeg="1" nights="0" days="0" men="2" reasonRus="Ok" reasonLat="Ok" sourceKey="0" flightKey="552" tariffKey="89" >
</flightService>
<flightService key="220697" name="А_П::АНТАЛИЯ/Москва/P76524, AYT-SVO2, 10:15-13:20/Y Экономический класс/" dayBeg="8" nights="0" days="0" men="2" reasonRus="Ok" reasonLat="Ok" sourceKey="0" flightKey="553" tariffKey="89" >
</flightService>
</flightServices>
<excursionServices />
<transferServices>
<transferService key="220702" name="Трансфер::.БЕЛЕК/Отель (Белек) - Аэропорт, , /автобус /" dayBeg="8" nights="0" days="0" men="2" reasonRus="Ok" reasonLat="Ok" sourceKey="0" transferKey="385" transportKey="3" />
<transferService key="220701" name="Трансфер::АНТАЛИЯ/Аэропорт-Отель (Белек), , /автобус /" dayBeg="1" nights="0" days="0" men="2" reasonRus="Ok" reasonLat="Ok" sourceKey="0" transferKey="383" transportKey="3" />
</transferServices>
<cruiseServices />
<extraServices>
<extraService key="220700" name="Страховка::Турция/Мед. страховка - 15000$,8 дней/-/" dayBeg="1" nights="7" days="8" men="2" reasonRus="Ok" reasonLat="Ok" sourceKey="0" classKey="6" subKey="161" subKey1="18" subKey2="0" countryKey="86" cityKey="187" />
</extraServices>
</services>
</packet>
</packets>
<persons>
<person key="92471" sourceKey="92471" packets="_1" services="" firstNameRus="TEST" lastNameRus="TEST" firstNameLat="TEST" lastNameLat="TEST" sex="male" birthday="1982-02-02" nationalityRus="" nationalityLat="" isTourist="true">
<contacts>
<phones>
<phone />
</phones>
<addresses>
<address postalIndex="" city="" street="" building="" flat="" />
</addresses>
</contacts>
<passports>
<passport type="foreign" series="1111" number="111111111" emittedBy="ОВД" emittedWhen="1990-01-01" validTo="2007-02-02" />
<passport type="national" number="" emittedBy="" emittedWhen="0001-01-01" validTo="0001-01-01" />
</passports>
</person>
<person key="92470" sourceKey="92470" packets="_1" services="" firstNameRus="TEST" lastNameRus="TEST" firstNameLat="TEST" lastNameLat="TEST" sex="male" birthday="1982-03-03" nationalityRus="" nationalityLat="" isTourist="true">
<contacts>
<phones>
<phone />
</phones>
<addresses>
<address postalIndex="" city="" street="" building="" flat="" />
</addresses>
</contacts>
<passports>
<passport type="foreign" series="1111" number="111111111" emittedBy="ОВД" emittedWhen="1990-01-01" validTo="2007-03-03" />
<passport type="national" number="" emittedBy="" emittedWhen="0001-01-01" validTo="0001-01-01" />
</passports>
</person>
</persons>
</agreement>
</agreements>
|
Ниже представлены экраны программного комплекса Мастер-Тур с результатами бронирования, выполненного в пункте работа с функцией CreateBooking.