需要在我的网站上使用yatra.com API

时间:2013-01-07 11:00:50

标签: asp.net xml vb.net api

asalamualikum,我需要在我的网站上使用yatra.com api,这是一个asp.net网站。我有一个来自yatra的word文档(空中集成文档)。 Yatra api是基于xml的,air集成文档显示了xml请求和响应的格式,但我没有在webservices中使用xml并且不知道但是我有xml的概念但是只使用xml来读取和写入本地系统上的文件。现在我有一个问题我不知道如何在webservices中使用xml以及如何从api接收响应并将其显示在我的页面上或发送请求到api ..如果有人可以帮助我,我将非常感谢他.... ..如果你能给我一个ne 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> 

1 个答案:

答案 0 :(得分:0)

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