Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 29, 2012 06:11 AM by mdaslamknlsp
Member
14 Points
8 Posts
Oct 12, 2012 11:31 AM|LINK
Hello All
I am able to send the request to hotelbeds using ws this below code
public string RequestResponseMethod(string serviceName, string xml, string filename) { Destination =new Microsoft.Web.Services3.Addressing.EndpointReference(new Uri("urn:" + serviceName), new Uri(http://212.170.239.71/appservices/ws/FrontendService)); SoapEnvelope env = new SoapEnvelope(System.Web.Services.Protocols.SoapProtocolVersion.Soap12); env.LoadXml(xml); SoapEnvelope envResponse = SendRequestResponse(serviceName, env); return envResponse.InnerXml;
}
***************************************************************************** XmlDocument doc1 = new XmlDocument();
doc1.InnerXml =@"<soapenv:Envelope soapenv:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"" xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""> <soapenv:Body> <hb:getHotelCategoryList xmlns:hb=""http://axis.frontend.hydra.hotelbeds.com"" xsi:type=""xsd:string""> <HotelCategoryListRQ echoToken=""DummyEchoToken"" xmlns=""http://www.hotelbeds.com/schemas/2005/06/messages"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.hotelbeds.com/schemas/2005/06/messages HotelListRQ.xsd""> <Language>ENG</Language> <Credentials> <User>TEST</User> <Password>TEST</Password> </Credentials> </HotelCategoryListRQ> </hb:getHotelCategoryList> </soapenv:Body> </soapenv:Envelope>"; XMLString = doc1.InnerXml.ToString();
string HotelResponse = soap.RequestResponseMethod("getHotelCategoryList", XMLString, Session.SessionID.ToString());
i am getting response like this
///////////////////////////////////////////////////////////////////////////////////////////
<?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> <ns1:getHotelList xsi:type="xsd:string" xmlns:ns1="http://axis.frontend.hydra.hotelbeds.com"> <HotelListRS xmlns="http://www.hotelbeds.com/schemas/2005/06/messages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hotelbeds.com/schemas/2005/06/messages HotelListRS.xsd" totalItems="522" echoToken="DummyEchoToken"> <AuditData> <ProcessTime>32</ProcessTime> <Timestamp>2012-10-12 13:29:08.743</Timestamp> <RequestHost>59.165.52.235:235</RequestHost> <ServerName>FORM</ServerName> <ServerId>FO</ServerId> <SchemaRelease>2005/06</SchemaRelease> <HydraCoreRelease>2.0.201207171444</HydraCoreRelease> <HydraEnumerationsRelease>1.0.201207171444</HydraEnumerationsRelease> <MerlinRelease>N/A</MerlinRelease> </AuditData> <ExtraInfoList> <ExtendedData type="EXT_ADDITIONAL_PARAM"> <Name>PARAM_HOTEL_LIST_TOTAL_PAGES</Name> <Value>1</Value> </ExtendedData> <ExtendedData type="EXT_ADDITIONAL_PARAM"> <Name>PARAM_HOTEL_LIST_PAGE_NUMBER</Name> <Value>1</Value> </ExtendedData> </ExtraInfoList> <Hotel xsi:type="ProductHotel"> <Code>128354</Code> <Name>Berrak Otel</Name> <DescriptionList> <Description type="Hotel" languageCode="ENG">Further information about this hotel will be available shortly</Description> </DescriptionList> <Category type="SIMPLE" code="2EST" shortname="2EST">2 STARS</Category> <Destination type="SIMPLE" code="IST"> <ZoneList> <Zone type="SIMPLE" code="4" serviceType="HO">Asian Side</Zone> </ZoneList> </Destination> </Hotel> </HotelListRS> </ns1:getHotelList> </soapenv:Body> </soapenv:Envelope>
//////////////////////////////////////////////////////////////////
i am getting this extra things
<soapenv:Envelope <soapenv:Body> <HotelListRS xmlns="http://www.hotelbeds.com/schemas/2005/06/messages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hotelbeds.com/schemas/2005/06/messages HotelListRS.xsd" totalItems="522" echoToken="DummyEchoToken">
i am unable to parse this can any 1 help parsing this
thanks
30 Points
53 Posts
Oct 13, 2012 10:36 AM|LINK
Hi aslam try the below code to get availability response.
Page Load { string xml_request = "<HotelValuedAvailRQ echoToken='DummyEchoToken' sessionId='" + ss.SessionID + "' xmlns='http://www.hotelbeds.com/schemas/2005/06/messages' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.hotelbeds.com/schemas/2005/06/messages HotelValuedAvailRQ.xsd'>" + "<Language>ENG</Language>" + "<Credentials>" + "<User>YourUserName</User>" + "<Password>YourPassword</Password>" + "</Credentials>" + " <ExtraParamList>" + "<ExtendedData type='EXT_ADDITIONAL_PARAM'> " + "<Name>PARAM_KEY_PRICE_BREAKDOWN</Name>" + "<Value>Y</Value>" + "</ExtendedData>" + "</ExtraParamList>" + "<PaginationData pageNumber='1' itemsPerPage='999' />" + "<CheckInDate date='" + Session["date1[2]"] + Session["date1[1]"] + Session["date1[0]"] + "' />" + "<CheckOutDate date='" + Session["date2[2]"] + Session["date2[1]"] + Session["date2[0]"] + "' />" + "<Destination code='" + Session["ddlDest"] + "' type='SIMPLE' >" + "0" + "</Destination>" + "<OccupancyList>" + "<HotelOccupancy>" + "<RoomCount>" + Session["ddlroomcount1"] + "</RoomCount>" + "<Occupancy>" + "<AdultCount>" + Session["adult"] + "</AdultCount>" + "<ChildCount>" + Session["txta3"] + "</ChildCount>" + "</Occupancy>" + "</HotelOccupancy>" + "</OccupancyList>" + "</HotelValuedAvailRQ>"; GetAvailablity(xml_request, null); } Void GetAvailablity(String xml_request, string proxy) { XmlDocument doc = new XmlDocument(); doc.LoadXml (xml_request); HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://212.170.239.71/appservices/http/FrontendService"); if (proxy != null) req.Proxy = new WebProxy(proxy, true); req.Headers.Add("SOAPAction", "\"\""); req.Method = WebRequestMethods.Http.Post; req.ContentType = "text/xml;charset=\"utf-8\""; req.Accept = "text/xml"; ASCIIEncoding encoding = new ASCIIEncoding(); Encoding enc = System.Text.Encoding.GetEncoding(1252); //Stream stm = req.GetRequestStream(); Stream stm; //stm = new System.IO.Compression.GZipStream(req.GetRequestStream(),System.IO.Compression.CompressionMode .Decompress ); stm = req.GetRequestStream(); doc.Save(stm); stm.Close(); HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); stm = resp.GetResponseStream(); if (resp.StatusCode == HttpStatusCode.OK) { StreamReader r = new StreamReader(stm, enc); XmlTextReader reader = null; reader = new XmlTextReader(r); DataSet ds = new DataSet(); ds.ReadXml(reader); } }
Nov 29, 2012 06:11 AM|LINK
Hello Ashish
Thanks for your code
i used your code to implement hotelbeds xml api i am successfully implemented
i understand to set the Adults Childrens and children ages as hotelbeds says to do like this
<OccupancyList> <HotelOccupancy> <RoomCount>2</RoomCount> <Occupancy> <AdultCount>2</AdultCount> <ChildCount>0</ChildCount> </Occupancy>
This for 2 rooms and 2 adults in each room 2 adultswhat if i have like this scenerioRoom 1: 2 Adult = Child 0Room 2: 2 Adult = Child 2 Age is 3 yearshow can i give like thiscan you help me regarding thisthanks
mdaslamknlsp
Member
14 Points
8 Posts
Re: xmlintegration
Oct 12, 2012 11:31 AM|LINK
Hello All
I am able to send the request to hotelbeds using ws this below code
public string RequestResponseMethod(string serviceName, string xml, string filename)
{
Destination =new Microsoft.Web.Services3.Addressing.EndpointReference(new Uri("urn:" + serviceName), new Uri(http://212.170.239.71/appservices/ws/FrontendService));
SoapEnvelope env = new SoapEnvelope(System.Web.Services.Protocols.SoapProtocolVersion.Soap12);
env.LoadXml(xml);
SoapEnvelope envResponse = SendRequestResponse(serviceName, env);
return envResponse.InnerXml;
}
*****************************************************************************
XmlDocument doc1 = new XmlDocument();
doc1.InnerXml =@"<soapenv:Envelope soapenv:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"" xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">
<soapenv:Body>
<hb:getHotelCategoryList xmlns:hb=""http://axis.frontend.hydra.hotelbeds.com"" xsi:type=""xsd:string"">
<HotelCategoryListRQ echoToken=""DummyEchoToken"" xmlns=""http://www.hotelbeds.com/schemas/2005/06/messages"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.hotelbeds.com/schemas/2005/06/messages HotelListRQ.xsd"">
<Language>ENG</Language>
<Credentials>
<User>TEST</User>
<Password>TEST</Password>
</Credentials>
</HotelCategoryListRQ>
</hb:getHotelCategoryList>
</soapenv:Body>
</soapenv:Envelope>";
XMLString = doc1.InnerXml.ToString();
string HotelResponse = soap.RequestResponseMethod("getHotelCategoryList", XMLString, Session.SessionID.ToString());
i am getting response like this
///////////////////////////////////////////////////////////////////////////////////////////
<?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> <ns1:getHotelList xsi:type="xsd:string" xmlns:ns1="http://axis.frontend.hydra.hotelbeds.com"> <HotelListRS xmlns="http://www.hotelbeds.com/schemas/2005/06/messages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hotelbeds.com/schemas/2005/06/messages HotelListRS.xsd" totalItems="522" echoToken="DummyEchoToken"> <AuditData> <ProcessTime>32</ProcessTime> <Timestamp>2012-10-12 13:29:08.743</Timestamp> <RequestHost>59.165.52.235:235</RequestHost> <ServerName>FORM</ServerName> <ServerId>FO</ServerId> <SchemaRelease>2005/06</SchemaRelease> <HydraCoreRelease>2.0.201207171444</HydraCoreRelease> <HydraEnumerationsRelease>1.0.201207171444</HydraEnumerationsRelease> <MerlinRelease>N/A</MerlinRelease> </AuditData> <ExtraInfoList> <ExtendedData type="EXT_ADDITIONAL_PARAM"> <Name>PARAM_HOTEL_LIST_TOTAL_PAGES</Name> <Value>1</Value> </ExtendedData> <ExtendedData type="EXT_ADDITIONAL_PARAM"> <Name>PARAM_HOTEL_LIST_PAGE_NUMBER</Name> <Value>1</Value> </ExtendedData> </ExtraInfoList> <Hotel xsi:type="ProductHotel"> <Code>128354</Code> <Name>Berrak Otel</Name> <DescriptionList> <Description type="Hotel" languageCode="ENG">Further information about this hotel will be available shortly</Description> </DescriptionList> <Category type="SIMPLE" code="2EST" shortname="2EST">2 STARS</Category> <Destination type="SIMPLE" code="IST"> <ZoneList> <Zone type="SIMPLE" code="4" serviceType="HO">Asian Side</Zone> </ZoneList> </Destination> </Hotel> </HotelListRS> </ns1:getHotelList> </soapenv:Body> </soapenv:Envelope>
//////////////////////////////////////////////////////////////////
i am getting this extra things
<soapenv:Envelope <soapenv:Body> <HotelListRS xmlns="http://www.hotelbeds.com/schemas/2005/06/messages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hotelbeds.com/schemas/2005/06/messages HotelListRS.xsd" totalItems="522" echoToken="DummyEchoToken">
i am unable to parse this can any 1 help parsing this
thanks
RizwanAnsari
Member
30 Points
53 Posts
Re: xmlintegration
Oct 13, 2012 10:36 AM|LINK
Page Load { string xml_request = "<HotelValuedAvailRQ echoToken='DummyEchoToken' sessionId='" + ss.SessionID + "' xmlns='http://www.hotelbeds.com/schemas/2005/06/messages' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.hotelbeds.com/schemas/2005/06/messages HotelValuedAvailRQ.xsd'>" + "<Language>ENG</Language>" + "<Credentials>" + "<User>YourUserName</User>" + "<Password>YourPassword</Password>" + "</Credentials>" + " <ExtraParamList>" + "<ExtendedData type='EXT_ADDITIONAL_PARAM'> " + "<Name>PARAM_KEY_PRICE_BREAKDOWN</Name>" + "<Value>Y</Value>" + "</ExtendedData>" + "</ExtraParamList>" + "<PaginationData pageNumber='1' itemsPerPage='999' />" + "<CheckInDate date='" + Session["date1[2]"] + Session["date1[1]"] + Session["date1[0]"] + "' />" + "<CheckOutDate date='" + Session["date2[2]"] + Session["date2[1]"] + Session["date2[0]"] + "' />" + "<Destination code='" + Session["ddlDest"] + "' type='SIMPLE' >" + "0" + "</Destination>" + "<OccupancyList>" + "<HotelOccupancy>" + "<RoomCount>" + Session["ddlroomcount1"] + "</RoomCount>" + "<Occupancy>" + "<AdultCount>" + Session["adult"] + "</AdultCount>" + "<ChildCount>" + Session["txta3"] + "</ChildCount>" + "</Occupancy>" + "</HotelOccupancy>" + "</OccupancyList>" + "</HotelValuedAvailRQ>"; GetAvailablity(xml_request, null); } Void GetAvailablity(String xml_request, string proxy) { XmlDocument doc = new XmlDocument(); doc.LoadXml (xml_request); HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://212.170.239.71/appservices/http/FrontendService"); if (proxy != null) req.Proxy = new WebProxy(proxy, true); req.Headers.Add("SOAPAction", "\"\""); req.Method = WebRequestMethods.Http.Post; req.ContentType = "text/xml;charset=\"utf-8\""; req.Accept = "text/xml"; ASCIIEncoding encoding = new ASCIIEncoding(); Encoding enc = System.Text.Encoding.GetEncoding(1252); //Stream stm = req.GetRequestStream(); Stream stm; //stm = new System.IO.Compression.GZipStream(req.GetRequestStream(),System.IO.Compression.CompressionMode .Decompress ); stm = req.GetRequestStream(); doc.Save(stm); stm.Close(); HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); stm = resp.GetResponseStream(); if (resp.StatusCode == HttpStatusCode.OK) { StreamReader r = new StreamReader(stm, enc); XmlTextReader reader = null; reader = new XmlTextReader(r); DataSet ds = new DataSet(); ds.ReadXml(reader); } }mdaslamknlsp
Member
14 Points
8 Posts
Re: xmlintegration
Nov 29, 2012 06:11 AM|LINK
Hello Ashish
Thanks for your code
i used your code to implement hotelbeds xml api i am successfully implemented
i understand to set the Adults Childrens and children ages
as hotelbeds says to do like this