Need to use yatra.com API in my website - asp.net

asalamualikum , I need to used yatra.com api on my website which is an asp.net website.I have got a word document from yatra(air integration document). Yatra api is xml based , air integration document shows format of xml requests and responses but I haven't used xml in webservices and have no idea but I have concept of xml but have used xml only to read and write files on local system.Now I have a problem I dont know how to use xml in webservices and how to recieve response from api and display it on my page or sent request to api..If any one can help me I will be very thankful to him......If you could give me ne url or a video where user have used some api(xml based) for integration. Help will be strongly appreciated.If anyone can give me sample code for below request and resonse.
Sample request to 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>
Sample Response from 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>

You no need to worry about creating the xml or consuming the xml, if you are using C sharp side use WCF or any tool to create client by using Yatra.com wsdl.
Now treat evrthing as object oriented it will be responsibility of your C sharp client stubs to generate XML. you just need to map the values in stubs.

Related

Here maps api for geocoder doesn't get the area shape for district

I used this Here Geocode API to get the area shapes for the district. However, there's no available shapes being returned on the API.
here is the link for the API
https://geocoder.ls.hereapi.com/6.2/geocode.xml?xnlp=CL_JSMv3.0.17.0&apiKey=<APIKEY>&searchtext=Cakung%20Barat%20Kel.%20Jakarta%2013910%20Indonesia&mode=retrieveAddresses&jsoncallback=H.service.jsonp.handleResponse(37)&gen=9&additionalData=IncludeShapeLevel,district
here is the response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:Search xmlns:ns2="http://www.navteq.com/lbsp/Search-Search/4">
<Response>
<MetaInfo>
<Timestamp>2021-07-28T10:09:26.934Z</Timestamp>
</MetaInfo>
<View xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:SearchResultsViewType">
<ViewId>0</ViewId>
<Result>
<Relevance>1.0</Relevance>
<MatchLevel>district</MatchLevel>
<MatchQuality>
<Country>1.0</Country>
<City>1.0</City>
<Subdistrict>1.0</Subdistrict>
<PostalCode>1.0</PostalCode>
</MatchQuality>
<Location>
<LocationId>NT_ezpLZJFGXsz2rWjEVeA2oD</LocationId>
<LocationType>area</LocationType>
<DisplayPosition>
<Latitude>-6.16492</Latitude>
<Longitude>106.93429</Longitude>
</DisplayPosition>
<NavigationPosition>
<Latitude>-6.16492</Latitude>
<Longitude>106.93429</Longitude>
</NavigationPosition>
<MapView>
<TopLeft>
<Latitude>-6.1516</Latitude>
<Longitude>106.92209</Longitude>
</TopLeft>
<BottomRight>
<Latitude>-6.19349</Latitude>
<Longitude>106.94349</Longitude>
</BottomRight>
</MapView>
<Address>
<Label>Cakung Barat Kel., Cakung, Jakarta, Indonesia</Label>
<Country>IDN</Country>
<County>DKI Jakarta</County>
<City>Jakarta</City>
<District>Cakung</District>
<Subdistrict>Cakung Barat Kel.</Subdistrict>
<PostalCode>13910</PostalCode>
<AdditionalData key="CountryName">Indonesia</AdditionalData>
<AdditionalData key="CountyName">DKI Jakarta</AdditionalData>
</Address>
</Location>
</Result>
</View>
</Response>
</ns2:Search>
it is working for city and other options. based from the documentation, district is included on valid shape levels
We have tried to reproduce the request but it was determined as the coverage range is not supportive to get district-level shape for Jakarta.
For Example,
Demo link: https://tcs.ext.here.com/examples/v3/admin_boundaries
Also, we have documentation information with regards to coverage range.
Link: https://developer.here.com/documentation/geocoder/dev_guide/topics/coverage-geocoder.html

WSO2 : Transforming response xml

I would like to turn this xml response into something more easily readable.
<?xml version="1.0" encoding="ISO-8859-1"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/>
<soap:Body>
<executeResponse xmlns="urn:GCE">
<BusinessViewServiceexecuteOut xmlns="http://www.generix.fr/technicalframework/businesscomponent/applicationmodule/common" xmlns:ns2="http://www.generixgroup.com/processus/configuration/scheduler" xmlns:ns3="http://www.generix.fr/technicalframework/business/service/common">
<xmlpres><?xml version = '1.0' encoding = 'UTF-8'?> <VueTable type="View" name="Table" habctr="true" total_business_row="2" nbline="400" confNbline="400" numpage="1" nbpage="1">
<JTblView name="JTblView" type="ViewObject" maxfetchsize="999" maxfetchsizeexceeded="false">
<JTblViewRow current="true" type="ViewRow" index="1" business_row_index="1">
<Cletbl precision="6" type="VARCHAR" pk="true">
<business_data>N</business_data>
</Cletbl>
<Codtbl precision="6" type="VARCHAR" pk="true">
<business_data>001</business_data>
</Codtbl>
<Lib1 precision="30" type="VARCHAR">
<business_data>Non</business_data>
</Lib1>
<Lib2 precision="30" type="VARCHAR">
<business_data/>
</Lib2>
<Lir precision="10" type="VARCHAR">
<business_data>Non</business_data>
</Lir>
</JTblViewRow>
<JTblViewRow type="ViewRow" index="2" business_row_index="2">
<Cletbl precision="6" type="VARCHAR" pk="true">
<business_data>O</business_data>
</Cletbl>
<Codtbl precision="6" type="VARCHAR" pk="true">
<business_data>001</business_data>
</Codtbl>
<Lib1 precision="30" type="VARCHAR">
<business_data>Oui</business_data>
</Lib1>
<Lib2 precision="30" type="VARCHAR">
<business_data/>
</Lib2>
<Lir precision="10" type="VARCHAR">
<business_data>Oui</business_data>
</Lir>
</JTblViewRow>
</JTblView>
</VueTable></xmlpres>
</BusinessViewServiceexecuteOut>
</executeResponse>
</soap:Body></soap:Envelope>
At least if I could extract what's in the value of "xmlpres", the better I could do:
<table><row><code></code><libelle></libelle/></row></table>
To then turn it into a json response but I can't see ... I just get all the output or in json stream but with everything , which is not usable.
Create an out-mediation sequence with the following content and attach it to the respective API and try out the scenario. This is to extract the xmlpres content and send that as the response to the client
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="out-sequence">
<!-- extract the xmlpres content and store as OM element -->
<property name="XMLBody"
expression="$body//soap:Body//generic:xmlpres"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:gce="urn:GCE"
xmlns:generic="http://www.generix.fr/technicalframework/businesscomponent/applicationmodule/common" type="OM" />
<!-- pass the extracted property as response body -->
<enrich>
<source type="property" property="XMLBody" />
<target type="body" />
</enrich>
</sequence>
Hope this helps you to extract and send the response accordingly.

Sabre PassengerDetailsRQ not return the ID attribute in ItineraryRef

I am trying to book an air segment using EnhancedAirBookRQ and PassengerDetailsRQ using development endpoint.
But in the response I did not get the ID it just sending the information like
<ItineraryRef AirExtras="false" InhibitCode="U" PartitionID="AA" PrimeHostID="1S">
but i should return like <ItineraryRef AirExtras="false" ID="DJEJWQ" InhibitCode="U" PartitionID="AA" PrimeHostID="1S">
Is there any reason for this? bellow is my request XML code.
<PassengerDetailsRQ xmlns="http://services.sabre.com/sp/pd/v3_4" version="3.4.0">
<PostProcessing >
<RedisplayReservation waitInterval="1000"/>
</PostProcessing>
<PreProcessing />
<SpecialReqDetails>
<SpecialServiceRQ>
<SpecialServiceInfo>
<AdvancePassenger SegmentNumber="A">
<Document ExpirationDate="2018-05-26" Number="1234567890" Type="P">
<IssueCountry>FR</IssueCountry>
<NationalityCountry>FR</NationalityCountry>
</Document>
<PersonName DateOfBirth="1980-12-02" Gender="M" NameNumber="1.1">
<GivenName>JAMES</GivenName>
<MiddleName>MALCOLM</MiddleName>
<Surname>GREEN</Surname>
</PersonName>
</AdvancePassenger>
</SpecialServiceInfo>
</SpecialServiceRQ>
</SpecialReqDetails>
<TravelItineraryAddInfoRQ>
<AgencyInfo>
<Address>
<AddressLine>SABRE TRAVEL</AddressLine>
<CityName>SOUTHLAKE</CityName>
<CountryCode>US</CountryCode>
<PostalCode>76092</PostalCode>
<StateCountyProv StateCode="TX"/>
<StreetNmbr>3150 SABRE DRIVE</StreetNmbr>
<VendorPrefs>
<Airline Hosted="true"/>
</VendorPrefs>
</Address>
</AgencyInfo>
<CustomerInfo>
<ContactNumbers>
<ContactNumber NameNumber="1.1" Phone="817-555-1212" PhoneUseType="H"/>
</ContactNumbers>
<PersonName NameNumber="1.1" NameReference="ABC123" PassengerType="ADT">
<GivenName>MALCOLM</GivenName>
<Surname>GREEN</Surname>
</PersonName>
</CustomerInfo>
</TravelItineraryAddInfoRQ>
</PassengerDetailsRQ>
Thanks

Gracenote eyeQ GNIDs changed over time

On August 6th, I made a TVGRID_LOOKUP request with the gracenote eyeQ API.
The response returned an Episode of "The Big Bang Theory - The Zazzy Substitution" (airing-time 21:45).
The TVPROGRAM GNID was 442470733-5294AFF66A2B66D6CF9368BCE777839F.
Today I made the same request and got a different GNID (445129959-C521A678BE53213977744678C90B202C).
What happend? I thought GNIDs are unique?
Just in case, here's my request:
<?xml version="1.0"?>
<QUERIES>
<AUTH>
<CLIENT>__CLIENT_ID__</CLIENT>
<USER>__USER_ID__</USER>
</AUTH>
<QUERY CMD="TVGRID_LOOKUP">
<TVCHANNEL>
<GN_ID>251533333-26F45A038CFBD8323F70D3944EB16008</GN_ID>
</TVCHANNEL>
<DATE TYPE="START">2014-08-11T20:00</DATE>
<DATE TYPE="END">2014-08-11T20:10</DATE>
</QUERY>
</QUERIES>
TVPROGRAM's are unique within the TVGRID, but are not guaranteed to be consistent from day to day. However, if you do a follow up query, you can get a unique GN_ID of the AV_WORK that represents the show/episode. For example:
<QUERIES>
<AUTH>
<CLIENT>_your_client_id_</CLIENT>
<USER>_your_user_id_</USER>
</AUTH>
<LANG>eng</LANG>
<COUNTRY>usa</COUNTRY>
<QUERY CMD="TVPROGRAM_FETCH">
<GN_ID>445129959-C521A678BE53213977744678C90B202C</GN_ID>
</QUERY>
</QUERIES>
Returns:
...
<AV_WORK>
<GN_ID>240234711-A3BEDE6BF00D48B35FAE5F0E66305B30</GN_ID>
</AV_WORK>
...
This AV_WORK GN_ID will be the same between the different TVPROGRAM GN_IDs you received.

Read SOAP result using a loop

I built a web service in C# web application. I'm returning list of objects as a web service result. I need to know how to read that list of items one by one in a loop.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<checkAvailabilityResponse xmlns="http://tempuri.org/">
<checkAvailabilityResult>
<Shedule>
<Sid>int</Sid>
<Fid>int</Fid>
<FromLocation>string</FromLocation>
<FromTime>dateTime</FromTime>
<ToLocation>string</ToLocation>
<ToTime>dateTime</ToTime>
<PriceSeatA>double</PriceSeatA>
<PriceSeatB>double</PriceSeatB>
<PriceSeatC>double</PriceSeatC>
</Shedule>
<Shedule>
<Sid>int</Sid>
<Fid>int</Fid>
<FromLocation>string</FromLocation>
<FromTime>dateTime</FromTime>
<ToLocation>string</ToLocation>
<ToTime>dateTime</ToTime>
<PriceSeatA>double</PriceSeatA>
<PriceSeatB>double</PriceSeatB>
<PriceSeatC>double</PriceSeatC>
</Shedule>
</checkAvailabilityResult>
</checkAvailabilityResponse>
</soap:Body>
</soap:Envelope>
This is the way I tried:
SriLankanWebService.Service1SoapClient air1 = new AgentPortal.SriLankanWebService.Service1SoapClient();
List<Shedule> air1Response = (List<Shedule>)air1.checkAvailability(drpFrom.SelectedValue.ToString(), drpTo.SelectedValue.ToString(), DateTime.Parse(txtDepartOn.Text));
When I tried it says:
Error 1 Cannot implicitly convert type 'AgentPortal.SriLankanWebService.Shedule[]' to 'System.Collections.Generic.List<AgentPortal.Shedule>' D:\DCBSD\AgentPortal\AgentPortal\Home.aspx.cs 32 46 AgentPortal
I need to use it in a loop.
Please update your code in last line from above code from:
List<Shedule> air1Response = (List<Shedule>)air1.checkAvailability(drpFrom.SelectedValue.ToString(), drpTo.SelectedValue.ToString(), DateTime.Parse(txtDepartOn.Text));
to
AgentPortal.SriLankanWebService.Shedule[] = air1.checkAvailability(drpFrom.SelectedValue.ToString(), drpTo.SelectedValue.ToString(), DateTime.Parse(txtDepartOn.Text));
That will fix the issue.

Resources