1

asalamualikum ,我需要在我的网站上使用 yatra.com api,这是一个 asp.net 网站。我从 yatra 获得了一个 word 文档(空气集成文档)。Yatra api 是基于 xml 的,空中集成文档显示 xml 请求和响应的格式,但我没有在 web 服务中使用 xml,也不知道,但我有 xml 的概念,但只使用 xml 在本地系统上读取和写入文件。现在我有一个问题,我不知道如何在 web 服务中使用 xml,以及如何接收来自 api 的响应并将其显示在我的页面上或向 api 发送请求。如果有人可以帮助我,我将非常感谢他.... ..如果你能给我一个 url 或一个用户使用一些 api(基于 xml)进行集成的视频。非常感谢您的帮助。如果有人可以给我以下请求和响应的示例代码。

对 yatra api 的示例请求:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<OTA_AirLowFareSearchRQ EchoToken="0" SequenceNmbr="0" TransactionIdentifier="0" AvailableFlightsOnly="" DirectFlightsOnly="" xmlns="http://www.opentravel.org/OTA/2003/05">
            <POS xmlns="http://www.opentravel.org/OTA/2003/05">
                <Source AgentSine="" PseudoCityCode="NPCK" TerminalID="1">
                    <RequestorID ID="AFFILIATE"/>
                </Source>
                <YatraRequests>
                    <YatraRequest AffiliateID="EASTBOUND"/>
                </YatraRequests>
            </POS>
            <TravelerInfoSummary>
                <AirTravelerAvail>
                    <PassengerTypeQuantity Code="ADT" Quantity="1"/>
                    <PassengerTypeQuantity Code="CHD" Quantity="1"/>
                    <PassengerTypeQuantity Code="INF" Quantity="1"/>
                </AirTravelerAvail>
            </TravelerInfoSummary>
            <SpecificFlightInfo>
                <Airline Code=""/>
            </SpecificFlightInfo>
            <OriginDestinationInformation>
                <DepartureDateTime>2011-09-11T00:00:00</DepartureDateTime>
                <OriginLocation CodeContext="IATA" LocationCode="DEL">DEL</OriginLocation>
                <DestinationLocation CodeContext="IATA" LocationCode="BOM">BOM</DestinationLocation>
            </OriginDestinationInformation>
            <TravelPreferences>
                <VendorPref Code="SG"/>
                <VendorPref Code="DN"/>
                <CabinPref Cabin=""/>
            </TravelPreferences>
        </OTA_AirLowFareSearchRQ>
    </soapenv:Body>
</soapenv:Envelope>

来自 yatra api 的示例响应

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <OTA_AirLowFareSearchRS Version="2.001" xmlns="http://www.opentravel.org/OTA/2003/05">
            <PricedItineraries>
                <PricedItinerary CompositeFlightNumber="S2101" CountCompositeFlightNumber="1" OriginDestinationRPH="0" SequenceNumber="1" SupplierSystem="Amadeus">
                    <AirItinerary SupplierSystem="Amadeus">
                        <OriginDestinationOptions>
                            <OriginDestinationOption Duration="01:55:00" FromCache="true" SupplierSystem="Amadeus">
                                <FlightSegment ArrivalDateTime="2007-11-11T08:55:00" DepartureDateTime="2007-11-11T07:00:00" E_TicketEligibility="Eligible" FlightNumber="101" RPH="1" ResBookDesigCode="O">
                                    <BookingClassAvail RPH="1" ResBookDesigCode="O" ResBookDesigQuantity="4"/>
                                    <DepartureAirport LocationCode="DEL"/>
                                    <ArrivalAirport LocationCode="BOM"/>
                                    <Equipment AirEquipType="737"/>
                                    <MarketingAirline Code="S2"/>
                                </FlightSegment>
       <FormData>
                <FareInformationIDs>
                <FareInformationID BaseFare="1825" Code="" FareCode="UGOSAVE" FareID="0" PTCID="1" Quantity="">0</FareInformationID>
            </FareInformationIDs>
      </FormData>                            
</OriginDestinationOption>
                        </OriginDestinationOptions>
                    </AirItinerary>
                    <AirItineraryPricingInfo>
                        <ItinTotalFare>
                            <BaseFare Amount="1875" CurrencyCode="INR"/>
                            <Taxes>
                                <Tax Amount="1575" CurrencyCode="INR" TaxCode="TTL"/>
                            </Taxes>
                            <TotalFare Amount="3461.63" CurrencyCode="INR"/>
                            <ServiceTax Amount="11.63" Currency="INR" Description="Service Tax" ServiceTaxCode="ST" ServiceTaxRate="0.0062"/>
                        </ItinTotalFare>
                        <PTC_FareBreakdowns>
                            <PTC_FareBreakdown>
                                <PassengerTypeQuantity Code="ADT" Quantity="1"/>
                                <FareBasisCodes>
                                    <FareBasisCode>OSASAS</FareBasisCode>
                                </FareBasisCodes>
                                <PassengerFare>
                                    <BaseFare Amount="1875" CurrencyCode="INR"/>
                                    <Taxes>
                                        <Tax Amount="1575" CurrencyCode="INR" TaxCode="TTL"/>
                                    </Taxes>
                                    <TotalFare Amount="3450" CurrencyCode="INR"/>
                                </PassengerFare>
                            </PTC_FareBreakdown>
                        </PTC_FareBreakdowns>
                        <FareInfos>
                            <FareInfo>
                                <FareReference>OSASAS</FareReference>
                                <FilingAirline Code="ZZ"/>
                                <DepartureAirport LocationCode="DEL"/>
                                <ArrivalAirport LocationCode="BOM"/>
                            </FareInfo>
                        </FareInfos>
                    </AirItineraryPricingInfo>
                    <TicketingInfo DeliveryMethod="EMAIL" TicketTimeLimit="" TicketType="eTicket" TicketingStatus="" eTicketNumber="">
                        <TicketAdvisory Language="English"/>
                    </TicketingInfo>
                </PricedItinerary>
            </PricedItineraries>
        </OTA_AirLowFareSearchRS>
    </soapenv:Body>
</soapenv:Envelope> 
4

1 回答 1

0

您无需担心创建 xml 或使用 xml,如果您使用 C 语言端使用 WCF 或任何工具通过使用 Yatra.com wsdl 创建客户端。现在将 evrthing 视为面向对象,它将由您的 C 语言客户端存根负责生成 XML。您只需要映射存根中的值。

于 2013-04-23T07:33:57.510 回答