locked
xmlintegration RRS feed

  • Question

  • User-2135850409 posted

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Home.aspx.cs" Inherits="SoapHeaderClient.Home" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <script type="text/javascript">
    function days()
    {
    alert('sdsd');
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; }
    body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #666666; }
    .style1 {color: #FF0000}
    -->
    </style>
    </head>

    <body>
    <form id="form1" runat="server">

    <table width="900" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="-moz-border-radius:10px 10px 10px 10px;
        -moz-box-shadow:3px 3px 3px rgba(0, 0, 0, 0.1); border: 1px solid #CCCCCC;">
      <tr>
        <td><table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><img src="images/logo.gif" width="305" height="71" /></td>
          </tr>
        </table>
          <table width="900" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><img src="images/strip.gif" width="900" height="10" /></td>
            </tr>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><span><strong>Accommodation</strong></span></td>
            </tr>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <%--<tr>
              <td width="130">Destination</td>
              <td width="10">:</td>
              <td width="660"><input type="text" name="textfield" id="textfield" /></td>
            </tr>--%>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="130" height="25">Country<span>*</span></td>
              <td width="10" height="25">:</td>
              <td width="660" height="25">
                  <asp:DropDownList  
                      ID="ddlCountry" runat="server" AutoPostBack="true"
                      onselectedindexchanged="ddlCountry_SelectedIndexChanged" Width="150px">
               
               
                
                
              </asp:DropDownList>
                  <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                      ControlToValidate="ddlCountry" Display="Dynamic" ErrorMessage="Select Country"
                      InitialValue="code"></asp:RequiredFieldValidator>
              </td>
            </tr>
            <tr>
              <td height="25">Destination<span>*</span></td>
              <td height="25">:</td>
              <td height="25">
                  <asp:DropDownList  ID="ddlDest" runat="server" AutoPostBack="true"
                      onselectedindexchanged="ddlDest_SelectedIndexChanged" Width="150px" >
               
                        </asp:DropDownList>
                  <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                      ControlToValidate="ddlDest" Display="Dynamic" ErrorMessage="Select Destination"
                      InitialValue="code"></asp:RequiredFieldValidator>
                            </td>
            </tr>
            <tr>
              <td height="25">Zone</td>
              <td height="25">:</td>
              <td height="25">
                  <asp:DropDownList  ID="ddlZone" runat="server" AutoPostBack="true"
                      onselectedindexchanged="ddlZone_SelectedIndexChanged" Width="150px"
                       >
               
                        </asp:DropDownList></td>
            </tr>
            <tr>
              <td height="25"></td>
              <td height="25"></td>
              <td height="25">
               <%--   <asp:DropDownList  ID="ddlAco" runat="server" Width="150px" onselectedindexchanged="ddlAco_SelectedIndexChanged"
                       >
               
                        </asp:DropDownList></td>--%>
            </tr>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td><table width="500" border="0" cellpadding="0" cellspacing="0">
                <tbody>
                  <tr>
                    <td width="133" height="25">From Date<span>*</span> </td>
                    <td width="73" height="25"><%--Nights<span>* </span>--%></td>
                    <td width="131" height="25">To Date<span>*</span> </td>
                  </tr>
                  <tr >
                    <td height="25" width="500" align="left"><asp:TextBox ID="txtCheckIn" Text="dd/mm/yyyy" runat="server" onfocus="if(self.gfPop)gfPop.fPopCalendar(txtCheckIn);return false;"></asp:TextBox>
                    <asp:ImageButton ID="imgFrom" OnClientClick ="if(self.gfPop)gfPop.fPopCalendar(txtCheckIn);return false;" runat="server" Height="18px" Width="16px" ImageUrl="images/calendar.gif" />
                     <%--<img src="images/calendar.gif" width="19" align="absmiddle" border="0" height="19" />--%></td>
                    <td height="25" align="left"><%--<select id="s_nights" name="s_nights">
                      <option>Nights</option>
                      <option value="1">1</option>
                      <option value="2">2</option>
                      <option selected="selected" value="3">3</option>
                      <option value="4">4</option>
                      <option value="5">5</option>
                      <option value="6">6</option>
                      <option value="7">7</option>
                      <option value="8">8</option>
                      <option value="9">9</option>
                      <option value="10">10</option>
                      <option value="11">11</option>
                      <option value="12">12</option>
                      <option value="13">13</option>
                      <option value="14">14</option>
                      <option value="15">15</option>
                      <option value="16">16</option>
                      <option value="17">17</option>
                      <option value="18">18</option>
                      <option value="19">19</option>
                      <option value="20">20</option>
                      <option value="21">21</option>
                      <option value="22">22</option>
                      <option value="23">23</option>
                      <option value="24">24</option>
                      <option value="25">25</option>
                      <option value="26">26</option>
                      <option value="27">27</option>
                      <option value="28">28</option>
                      <option value="29">29</option>
                      <option value="30">30</option>
                    </select>--%></td>
                    <td height="25"  width="500" align="left"><asp:TextBox ID="txtCheckOut" Text="dd/mm/yyyy" onfocus="if(self.gfPop)gfPop1.fPopCalendar(txtCheckOut);return false;" runat="server"></asp:TextBox>
                    <asp:ImageButton ID="imgTO" OnClientClick ="if(self.gfPop)gfPop1.fPopCalendar(txtCheckOut);return false;" runat="server" Height="18px" Width="16px" ImageUrl="images/calendar.gif" />
                     <%--<img src="images/calendar.gif" width="19" align="absmiddle" border="0" height="19" />--%></td>
                  </tr>
                </tbody>
              </table></td>
            </tr>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td><table width="596" border="0" cellpadding="0" cellspacing="0">
                <tbody>
                  <tr>
                    <td colspan="13" height="30"> Up to 4 pax/room<span>*</span> </td>
                  </tr>
                  <tr>
                 <td width="20" align="right"><img alt="" src="images/ico_pax1.gif" width="9" height="15" /></td>
    <td width="32" align="left"><%--<input alt="One adult" value="0" size="2" id="i_pax1_0" name="i_pax1_0" type="text" />--%><asp:TextBox runat="server" ID="txta1" Width="30px">0</asp:TextBox></td>
    <td width="21" align="right"><img src="images/ico_pax1.gif" width="9" height="15" /><img alt="" src="images/ico_pax1.gif" width="9" height="15" /></td>
    <td width="32" align="left"><%--<input alt="Two adults" value="0" size="2" id="i_pax2_0" name="i_pax2_0" type="text" />--%><asp:TextBox runat="server" ID="txta2" Width="30px">0</asp:TextBox></td>
    <td width="31" align="right"><img src="images/ico_pax1.gif" width="9" height="15" /><img src="images/ico_pax1.gif" width="9" height="15" /><img alt="" src="images/ico_pax1.gif" width="9" height="15" /></td>
    <td width="32" align="left"><%--<input alt="Three adults" value="0" size="2" id="i_pax3_0" name="i_pax3_0" type="text" />--%><asp:TextBox runat="server" ID="txta3" Width="30px">0</asp:TextBox></td>

                    <td width="41" align="right">&nbsp;</td>
                    <td width="32" align="left">&nbsp;</td>
                    <td width="19" align="right">&nbsp;</td>
                    <td width="32" align="left">&nbsp;</td>
                    <td width="19" align="right">&nbsp;</td>
                    <td width="32" align="left">&nbsp;</td>
                    <td width="28" align="right">&nbsp;</td>
                    <td align="left">
                            <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label>
                                            </td>
                  </tr>
                </tbody>
              </table></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <%--<tr>
              <td width="266"><div align="right">Total Pax &nbsp;</div></td>
              <td width="25">:</td>
              <td width="509"><input alt="Three adults" value="0"  size="2" id="i_pax3_" name="i_pax3_" type="text" /></td>
            </tr>--%>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><table width="323" border="0" cellpadding="0" cellspacing="0">
                <tbody>
                  <tr>
                    <td width="117" align="left"> *&nbsp;<span>Mandatory
                        fields</span></td>
                    <td width="206" align="right"><%--<input value="Delete" name="Submit" type="reset" />--%>
                        &nbsp;&nbsp;<asp:ImageButton ID="btnSearch" ImageUrl="~/images/Search_1.jpg"
                            runat="server" onclick="btnSearch_Click1" />
                      
                  
                      <%--<input value="Search" onclick="javascript: actualizaCookie(); sumPaxes(this.form); checkSubmit('To continue with the booking, please specify the age of the children:','Rooms','Ages','Continue','Cancel','');" id="b_search" name="b_search" type="button" />--%>
                        &nbsp; </td>
                        <td>
                            &nbsp;</td>
                  </tr>
                </tbody>
              </table></td>
            </tr>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>
                </td>
      </tr>
    </table>
    </form>
     <IFRAME id="gToday:..\JavaScript\normal:..\JavaScript\agenda.js" style="Z-INDEX: 105; LEFT: -500px; VISIBILITY: visible; POSITION: absolute; TOP: -500px"
                name="gToday:..\JavaScript\normal:..\JavaScript\agenda.js" src="Calender/ipopeng.htm"
                frameBorder="0" width="174" scrolling="no" height="189"></IFRAME>
                 <IFRAME id="gToday:..\JavaScript\normal:..\JavaScript\agenda1.js" style="Z-INDEX: 105; LEFT: -500px; VISIBILITY: visible; POSITION: absolute; TOP: -500px"
                name="gToday:..\JavaScript\normal:..\JavaScript\agenda1.js" src="Calender/ipopeng1.htm"
                frameBorder="0" width="174" scrolling="no" height="189"></IFRAME>
    </body>
    </html>








    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using System.Xml;
    using System.Text;
    using System.IO;
    using System.Net;
    using System.Data.SqlClient;



    namespace SoapHeaderClient
    {
        public partial class Home : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    txtCheckIn.Text = DateTime.Now.ToString("dd/MM/yyyy");
                    txtCheckOut.Text = DateTime.Now.AddDays(2).ToString("dd/MM/yyyy");

                    SqlConnection con = new SqlConnection("Data Source=DEVDEVELOPER-4\\SQLEXPRESS;Initial Catalog=xmlintegration;User Id=sa;password=sa123");

                    SqlDataAdapter da = new SqlDataAdapter(" select * from countryids where lang_code='ENG' ", con);
                    DataSet ds = new DataSet();
                    da.Fill(ds, "fg");

                    ListItem litem;
                    ddlCountry.Items.Add(new ListItem("Country", "code"));

                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        ddlCountry.Items.Add(new ListItem(ds.Tables[0].Rows[i]["Country"].ToString(), ds.Tables[0].Rows[i]["Country_Code"].ToString()));
                    }
               
                }

                
            }

            //void HttpSOAPAvailablity()
            //{
            //    String xml_request;
            //    xml_request = Request.Params["xml_request"];
            //    xml_request = "HotelCategoryListRQ.xml";
            //    string proxy;
            //    proxy = null;

            //    XmlDocument doc = new XmlDocument();

            //    doc.Load(@"E:\SoapHeaderClient\SoapHeaderClient\" + xml_request);
            //    HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://212.170.239.71/appservices/http/FrontendService");


            //    if (proxy != null) req.Proxy = new WebProxy(proxy, true);
            //    // if SOAPAction header is required, add it here...


            //    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();
            //    doc.Save(stm);
            //    stm.Close();


            //    HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
            //    stm = resp.GetResponseStream();


            //    if (resp.StatusCode == HttpStatusCode.OK)
            //    {
            //        DataSet datas = new DataSet();
            //        datas.ReadXml(stm);

            //        ListItem litem;
            //        ddlCountry.Items.Add(new ListItem("Country", "code"));

            //    for (int i=0;i< datas.Tables["Country"].Rows.Count;i++)
            //        {
            //   ddlCountry.Items.Add(new ListItem( datas.Tables["Country"].Rows[i]["Name"].ToString(),datas.Tables["Country"].Rows[i]["code"].ToString()));
            //       }
        
                  

            //        StreamReader r = new StreamReader(stm, enc);
            //        string tmp = r.ReadToEnd();
            //        resp.Close();
            //        r.Close();



            //    }


            //}


            protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
            {



                SqlConnection con = new SqlConnection("Data Source=DEVDEVELOPER-4\\SQLEXPRESS;Initial Catalog=xmlintegration;User Id=sa;password=sa123");

                SqlDataAdapter da = new SqlDataAdapter("select * from destinationids did" +
    " inner join destinations  d on did.dest_code=d.dest_code" +
    " inner join countryids cid on cid.country_code= d.country_code" +
    " where cid.lang_code='ENG' AND DID.LANG_CODE='ENG' and d.country_code= '" + ddlCountry.SelectedItem.Value.ToString() + "'", con);
                DataSet ds = new DataSet();
                da.Fill(ds, "fg");

                ListItem litem;
                ddlDest.Items.Add(new ListItem("Destination", "code"));

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    ddlDest.Items.Add(new ListItem(ds.Tables[0].Rows[i]["Dest"].ToString(), ds.Tables[0].Rows[i]["Dest_Code"].ToString()));
                }
                Session["country"] = ddlCountry.SelectedItem.Text;
    //            String xml_request;
    //            xml_request = Request.Params["xml_request"];


    //            Session["country"] = ddlCountry.SelectedItem.Text;

    //            string tmp1;
    //            tmp1 = "<HotelCountryListRQ 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 HotelCountryListRQ.xsd'>" +
    //  "<Language>ENG</Language>" +
    //  "<Credentials>" +
    //    "<User>JNANTOURSBH2944</User>" +
    //    "<Password>JNANTOURSBH2944</Password>" +
    //  "</Credentials>" +
    //  "<CountryCode>" + ddlCountry.SelectedItem.Value+ "</CountryCode>" +
    //"</HotelCountryListRQ>";
    //            XmlDocument xmldoc1 = new XmlDocument();
    //            xmldoc1.LoadXml(tmp1);
    //            xmldoc1.Save(@"E:\SoapHeaderClient\SoapHeaderClient\HotelCategoryListRQ0.xml");
                       




    //            xml_request = "HotelCategoryListRQ0.xml";
    //            string proxy;
    //            proxy = null;

    //            XmlDocument doc = new XmlDocument();

    //            doc.Load(@"E:\SoapHeaderClient\SoapHeaderClient\" + xml_request);
    //            HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://212.170.239.71/appservices/http/FrontendService");


    //            if (proxy != null) req.Proxy = new WebProxy(proxy, true);
    //            // if SOAPAction header is required, add it here...


    //            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();
    //            doc.Save(stm);
    //            stm.Close();


    //            HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
    //            stm = resp.GetResponseStream();


    //            if (resp.StatusCode == HttpStatusCode.OK)
    //            {
    //                DataSet datas = new DataSet();
    //                datas.ReadXml(stm);


    //                ddlDest.Items.Clear();
    //                ListItem litem;
    //                ddlDest.Items.Add(new ListItem("Destination", "code"));

    //                for (int i = 0; i < datas.Tables["Destination"].Rows.Count; i++)
    //                {
    //                    ddlDest.Items.Add(new ListItem(datas.Tables["Destination"].Rows[i]["Name"].ToString(), datas.Tables["Destination"].Rows[i]["code"].ToString()));
    //                }


                  
    //                StreamReader r = new StreamReader(stm, enc);
    //                string tmp = r.ReadToEnd();
    //                resp.Close();
    //                r.Close();



    //            }

            }

            protected void ddlDest_SelectedIndexChanged(object sender, EventArgs e)
          {

              SqlConnection con = new SqlConnection("Data Source=DEVDEVELOPER-4\\SQLEXPRESS;Initial Catalog=xmlintegration;User Id=sa;password=sa123");

              SqlDataAdapter da = new SqlDataAdapter("select * from" +
    " zones z inner join" +
    " destinationids did on z.dest_code=did.dest_code" +
    " inner join destinations  d on did.dest_code=d.dest_code" +
    " inner join countryids cid on cid.country_code= d.country_code" +
    " where cid.lang_code='ENG' AND DID.LANG_CODE='ENG' and z.dest_code='" + ddlDest.SelectedItem.Value.ToString() + "'", con);
              DataSet ds = new DataSet();
              da.Fill(ds, "fg");

              ListItem litem;
              ddlZone.Items.Add(new ListItem("Zone", "code"));

              for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
              {
                  ddlZone.Items.Add(new ListItem(ds.Tables[0].Rows[i]["Zone"].ToString(), ds.Tables[0].Rows[i]["Zone_Id"].ToString()));
              }
              Session["destination"] = ddlDest.SelectedItem.Text;

    //            String xml_request;
    //            xml_request = Request.Params["xml_request"];

    //            Session["destination"] = ddlDest.SelectedItem.Text;

    //            string tmp1;
    //            tmp1 = "<HotelCountryListRQ 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 HotelCountryListRQ.xsd'>" +
    //  "<Language>ENG</Language>" +
    //  "<Credentials>" +
    //    "<User>JNANTOURSBH2944</User>" +
    //    "<Password>JNANTOURSBH2944</Password>" +
    //  "</Credentials>" +
    //  "<Destination code='" + ddlDest.SelectedItem.Value + "' type='SIMPLE' >" +
    //  "</Destination>" +
    //"</HotelCountryListRQ>";



    //            XmlDocument xmldoc1 = new XmlDocument();
    //            xmldoc1.LoadXml(tmp1);
    //            xmldoc1.Save(@"E:\SoapHeaderClient\SoapHeaderClient\HotelCategoryListRQ00.xml");
                       



    //            xml_request = "HotelCategoryListRQ00.xml";
    //            string proxy;
    //            proxy = null;

    //            XmlDocument doc = new XmlDocument();

    //            doc.Load(@"E:\SoapHeaderClient\SoapHeaderClient\" + xml_request);
    //            HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://212.170.239.71/appservices/http/FrontendService");


    //            if (proxy != null) req.Proxy = new WebProxy(proxy, true);
    //            // if SOAPAction header is required, add it here...


    //            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();
    //            doc.Save(stm);
    //            stm.Close();


    //            HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
    //            stm = resp.GetResponseStream();


    //            if (resp.StatusCode == HttpStatusCode.OK)
    //            {
    //                DataSet datas = new DataSet();
    //                datas.ReadXml(stm);


    //                ddlZone.Items.Clear();
    //                ListItem litem;
    //                ddlZone.Items.Add(new ListItem("Zone", "code"));

    //                for (int i = 0; i < datas.Tables["Zone"].Rows.Count; i++)
    //                {
    //                    ddlZone.Items.Add(new ListItem(datas.Tables["Zone"].Rows[i]["Zone_Text"].ToString(), datas.Tables["Zone"].Rows[i]["code"].ToString()));
    //                }

            
    //                StreamReader r = new StreamReader(stm, enc);
    //                string tmp = r.ReadToEnd();
    //                resp.Close();
    //                r.Close();



    //            }
            }

            protected void ddlZone_SelectedIndexChanged(object sender, EventArgs e)
            {

                //String xml_request;
                //xml_request = Request.Params["xml_request"];
                //xml_request = "HotelCategoryListRQ000.xml";
                //string proxy;
                //proxy = null;

                //XmlDocument doc = new XmlDocument();

                //doc.Load(@"E:\SoapHeaderClient\SoapHeaderClient\" + xml_request);
                //HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://212.170.239.71/appservices/http/FrontendService");


                //if (proxy != null) req.Proxy = new WebProxy(proxy, true);
                //// if SOAPAction header is required, add it here...


                //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();
                //doc.Save(stm);
                //stm.Close();


                //HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
                //stm = resp.GetResponseStream();


                //if (resp.StatusCode == HttpStatusCode.OK)
                //{
                //    DataSet datas = new DataSet();
                //    datas.ReadXml(stm);


                //    StreamReader r = new StreamReader(stm, enc);
                //    string tmp = r.ReadToEnd();
                //    resp.Close();
                //    r.Close();



                //}

            }

     
            protected void btnSearch_Click1(object sender, ImageClickEventArgs e)
            {


                String xml_request;
                xml_request = Request.Params["xml_request"];

                int adult;
                adult = 0;
                int room;
                room = 0;

                //if (txta1.Text.Trim() == "0" || txta1.Text.Trim() == "" || txta2.Text.Trim() == "0" || txta2.Text.Trim() == "" || txta3.Text.Trim() == "0" || txta3.Text.Trim() == "")
                //{
                //    lblError.Text = "Enter Passenger Count";

                //    return;

                //}
                //else
                //{


                    if (txta1.Text.Trim() != "0" && txta1.Text.Trim() != "")
                    {

                        adult = adult + Convert.ToInt32(txta1.Text.Trim()) * 1;
                        room = room + 1;
                        Session["txta1"] = txta1.Text;
                    }
                    else
                    {
                        Session["txta1"] = "0";
                    }
                    if (txta2.Text.Trim() != "0" && txta2.Text.Trim() != "")
                    {
                        adult = adult + Convert.ToInt32(txta2.Text.Trim()) * 2;
                        room = room + 1;
                        Session["txta2"] = txta2.Text;
                    }
                    else
                    {
                        Session["txta2"] = "0";
                    }

                    if (txta3.Text.Trim() != "0" && txta3.Text.Trim() != "")
                    {
                        adult = adult + Convert.ToInt32(txta3.Text.Trim()) * 3;
                        room = room + 1;
                        Session["txta3"] = txta3.Text;
                    }

                    else
                    {
                        Session["txta3"] = "0";
                    }
                    
                
                //}


                string[] date1 = txtCheckIn.Text.Split('/');
                string[] date2 = txtCheckOut.Text.Split('/');

                string zone;
                zone = "";
                if (ddlZone.SelectedItem.Value != "code" )
                {
                    zone = zone + "<ZoneList>" +
                    "<Zone type='SIMPLE' code='" + ddlZone.SelectedItem.Value + "'></Zone>" +
                    "</ZoneList>";
                }

                string tmp1;
                tmp1 = "<HotelValuedAvailRQ echoToken='DummyEchoToken' sessionId='DummySessionId' 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>JNANTOURSBH2944</User>" +
                "<Password>JNANTOURSBH2944</Password>" +
                "</Credentials>" +
                "<PaginationData pageNumber='1' itemsPerPage='999' />" +
                "<CheckInDate date='" + date1[2] + date1[1] + date1[0] + "' />" +
                "<CheckOutDate date='" + date2[2] + date2[1] + date2[0] + "' />" +
                "<Destination code='" + ddlDest.SelectedItem.Value + "' type='SIMPLE' >" +zone+
                "</Destination>" +
                "<OccupancyList>" +
                "<HotelOccupancy>" +
                "<RoomCount>" + room.ToString() + "</RoomCount>" +
                "<Occupancy>" +
                "<AdultCount>" + adult.ToString() + "</AdultCount>" +
                "</Occupancy>" +
                "</HotelOccupancy>" +
                "</OccupancyList>" +
                "</HotelValuedAvailRQ>";
                XmlDocument xmldoc1 = new XmlDocument();
                xmldoc1.LoadXml(tmp1);
                xmldoc1.Save(@"F:\SoapHeaderClient\SoapHeaderClient\HotelCategoryListRQ1.xml");





                xml_request = "HotelCategoryListRQ1.xml";
                string proxy;
                proxy = null;

                XmlDocument doc = new XmlDocument();

                doc.Load(@"F:\SoapHeaderClient\SoapHeaderClient\" + xml_request);
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://212.170.239.71/appservices/http/FrontendService");


                if (proxy != null) req.Proxy = new WebProxy(proxy, true);
                // if SOAPAction header is required, add it here...


                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();
                doc.Save(stm);
                stm.Close();


                HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
                stm = resp.GetResponseStream();


                if (resp.StatusCode == HttpStatusCode.OK)
                {

                 
                    Session["checkIn"]= txtCheckIn.Text.Trim();
                    Session["checkOut"] = txtCheckOut.Text.Trim();


                    string fDate, tDate;
                    string[] str = new string[10];
                    str = txtCheckIn.Text.Split('/');
                    string fd, fm, fy;
                    fd = str[0];
                    fm = str[1];
                    fy = str[2];

                    fDate = fm + "/" + fd + "/" + fy;

                    string[] str1 = new string[10];
                    str1 = txtCheckOut.Text.Split('/');
                    string td, tm, ty;
                    td = str1[0];
                    tm = str1[1];
                    ty = str1[2];

                    tDate = tm + "/" + td + "/" + ty;


                    DateTime frmDate, toDate;

                    frmDate = DateTime.Parse(fDate);

                    toDate = DateTime.Parse(tDate);

                    System.TimeSpan diffResult = toDate.Subtract(frmDate);

                    int nights;

                    nights = diffResult.Days;

                     

                    if (nights < 0)
                    {

                         lblError.Text = "Invalid Check In Date";

                    }

                    else if (nights == 0)
                    {

                        lblError.Text = "Dates should not be same";
                    }

                    else
                    {

                        Response.Redirect("HotelListing.aspx");

                    }


                   



                }

            }

            protected void ddlAco_SelectedIndexChanged(object sender, EventArgs e)
            {

            }

           
        }
    }







    <%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="true" CodeBehind="HotelListing.aspx.cs" Inherits="SoapHeaderClient.HotelListing" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
        <style type="text/css">
    <!--
    body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; }
    body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #666666; }
    .style4 {color: #FFFFFF; font-weight: bold; font-size: 12px; }
    .style5 {color: #F0F0F0}
    .style7 {color: #000000;font-size: 11px; }
    .style8 {color: #000000;font-size: 11px;}

    -->
    </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
        <table width="900" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="-moz-border-radius:10px 10px 10px 10px;
        -moz-box-shadow:3px 3px 3px rgba(0, 0, 0, 0.1); border: 1px solid #CCCCCC;">
      <tr>
        <td>
         <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td width="655">&nbsp;</td>
    <td width="47">&nbsp;</td>
    <td width="98">&nbsp;</td>
    </tr>
    <tr>
    <td><img src="images/logo.gif" width="305" height="71" /></td>
    <td>&nbsp;</td>
    <td valign="bottom">
        <asp:ImageButton ID="ImageButton1" ImageUrl="~/images/bck_to_search.jpg"
            runat="server" onclick="ImageButton1_Click" /></td>
    </tr>
    </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>
                  &nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"><span></span></div></td>
                    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"></div></td>
                    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"></div></td>
                    <td width="200" height="20" bgcolor="#E8E8E8"><div align="center"></div></td>
                  </tr>
                  <tr>
    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center">Country</div></td>
    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center">Destination</div></td>
    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"></div></td>
    <td width="200" height="20" bgcolor="#E8E8E8"><div align="center">Accommadation</div></td>
    </tr>

                  <tr>
                    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"><span>
                        <asp:Label ID="lblCountry" runat="server" Text=""></asp:Label></span></div></td>
                    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"> <asp:Label ID="lblDestination" runat="server" Text=""></asp:Label></div></td>
                    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"></div></td>
                    <td width="200" height="20" bgcolor="#E8E8E8"><div align="center"><span>Resort :</span> All</div></td>
                  </tr>
                  <tr>
                    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"><span></span></div></td>
                    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"></div></td>
                    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"></div></td>
                    <td width="200" height="20" bgcolor="#E8E8E8"><div align="center"></div></td>
                  </tr>
                  <tr>
                    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"><span>From Date :</span>
                        <asp:Label ID="lblFromDate" runat="server" Text=""></asp:Label></div></td>
                    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"><span>To Date :</span> <asp:Label ID="lblToDate" runat="server" Text=""></asp:Label></div></td>
                    <td width="150" height="20" bgcolor="#E8E8E8"><div align="center"><span>Nights :</span> <asp:Label ID="lblNights" runat="server" Text=""></asp:Label></div></td>
                   <td width="200" height="20" bgcolor="#E8E8E8"><div align="center"
    style="width: 242px"><span>Units :</span> <img src="images/ico_pax1.gif" width="9" height="15" visible="false" runat="server" id="imgPsg1"/>
    <asp:Label ID="PsgCnt1" CssClass="style8" runat="server" Text="Label" Visible="False"
      ForeColor="Black"></asp:Label>&nbsp;&nbsp;<img src="images/ico_pax1.gif" width="9" height="15" visible="false" runat="server" id="imgPsg2"/><img src="images/ico_pax1.gif" width="9" height="15" visible="false" runat="server" id="imgPsg2a"/>
    <asp:Label ID="PsgCnt2" CssClass="style8" runat="server" Text="Label" Visible="False"
      ForeColor="Black"></asp:Label>&nbsp;&nbsp;<img src="images/ico_pax1.gif" width="9" height="15" visible="false" runat="server" id="imgPsg3"/><img src="images/ico_pax1.gif" width="9" height="15" visible="false" runat="server" id="imgPsg3a"/><img src="images/ico_pax1.gif" width="9" height="15" visible="false" runat="server" id="imgPsg3b"/>
    <asp:Label ID="PsgCnt3" CssClass="style8" runat="server" Text="Label" Visible="False"
     ForeColor="Black"></asp:Label></div></td>

                  </tr>
                  <tr>
                    <td height="20" bgcolor="#E8E8E8"><div align="center"></div></td>
                    <td height="20" bgcolor="#E8E8E8"><div align="center"></div></td>
                    <td height="20" bgcolor="#E8E8E8"><div align="center"></div></td>
                    <td height="20" bgcolor="#E8E8E8"><div align="center"></div></td>
                  </tr>
                </table></td>
            </tr>
          </table>
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>
          
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>
              
               <%--<asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="true"
             ></asp:GridView>--%>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"   
                DataKeyNames="HotelCode" onrowdatabound="GridView1_RowDataBound"
                ShowHeader="False">
             <Columns>
             <asp:TemplateField>
            <ItemTemplate>
            
             <table width="800" border="0" align="center" cellpadding="0" cellspacing="2">
                <tr>
                  <td height="20" bgcolor="#DC0101"><table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="260"><span><%# DataBinder.Eval(Container.DataItem, "Name")%></span></td>
                      <td width="158"><span><%# DataBinder.Eval(Container.DataItem, "CategoryCode")%></td>
                      <td width="382"><span><%# DataBinder.Eval(Container.DataItem, "Zone")%></span></td>
                    </tr>
                  </table></td>
                </tr>
              </table>
            
           
                  <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
                    ShowHeader="False"
                    onrowdatabound="GridView2_RowDataBound"
                    DataKeyNames="shrui" onrowcommand="GridView2_RowCommand">
                   <Columns>
             <asp:TemplateField>
            <ItemTemplate>
            
            <table width="800" border="0" align="center" cellpadding="0" cellspacing="2">
                  <tr>
                     <%-- <td bgcolor="#E8E8E8" height="20" width="150">
                          <div align="center">
                              <span></span>
                          </div>
                      </td>--%>
                      <td bgcolor="#E8E8E8" height="20" width="300">
                          <div align="left">
                              <%# DataBinder.Eval(Container.DataItem, "RoomType")%></div>
                      </td>
                      <td bgcolor="#E8E8E8" height="20" width="50">
                          <div align="center">
                              <%# DataBinder.Eval(Container.DataItem, "ShortName")%></div>
                      </td>
                      <td bgcolor="#E8E8E8" height="20" width="150">
                          <div align="center">
                              <%# DataBinder.Eval(Container.DataItem, "Amount")%> USD</div>
                      </td>
                      <td bgcolor="#E8E8E8" height="20" width="200">
                          <div align="right">
                         
                          <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/add.gif"
                             CommandName="Add" />
                               </div>
                      </td>
                  </tr>
                 
                </table>
            
                  
             </ItemTemplate>
          </asp:TemplateField>    
       </Columns>
       
       </asp:GridView>
                <asp:DataList ID="DataList1" runat="server"
                    onitemdatabound="DataList1_ItemDataBound" RepeatColumns="6"
                    RepeatDirection="Horizontal">
              <ItemTemplate>
               
                     <img id="imgList" runat="server" />
                    
                   
                </ItemTemplate>
                </asp:DataList>
        
     
       </ItemTemplate>
          </asp:TemplateField>    
       </Columns>
       
       </asp:GridView></td>
            </tr>
          </table>
         
          <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table></td>
      </tr>
    </table>
        
        
        </div>
        </form>
    </body>
    </html>




    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using System.Xml;
    using System.Text;
    using System.IO;
    using System.Net;
    using System.Data.SqlTypes;

    namespace SoapHeaderClient
    {
        
        public partial class HotelListing : System.Web.UI.Page
        {


            System.Data.DataTable objAvailableRooms = new System.Data.DataTable();

            System.Data.DataTable objHotelInfo = new System.Data.DataTable();

            System.Data.DataTable objImages = new System.Data.DataTable();

            protected void Page_Load(object sender, EventArgs e)
            {

                if (!Page.IsPostBack)
                {

                    XmlDocument xmldoc = new XmlDocument();



                    string xml_request;

                    xml_request = Request.Params["xml_request"];


                    //xml_request = "HotelValuedAvailRQ.xml";

                    xml_request = "HotelCategoryListRQ1.xml";

                    HttpSOAPAvailablity(xml_request, null);

                    lblCountry.Text = Session["country"].ToString();

                    lblDestination.Text = Session["destination"].ToString();

                    lblFromDate.Text = Session["checkIn"].ToString();

                    lblToDate.Text = Session["checkOut"].ToString();


                    if (Session["txta1"].ToString() != "0")
                    {
                        imgPsg1.Visible = true;
                        PsgCnt1.Text = " * " + Session["txta1"].ToString();
                        PsgCnt1.Visible = true;
                    }


                    if (Session["txta2"].ToString() != "0")
                    {
                        imgPsg2.Visible = true;
                        imgPsg2a.Visible = true;
                        PsgCnt2.Text = " * " + Session["txta2"].ToString();
                        PsgCnt2.Visible = true;
                    }


                    if (Session["txta3"].ToString() != "0")
                    {
                        imgPsg3.Visible = true;
                        imgPsg3a.Visible = true;
                        imgPsg3b.Visible = true;
                        PsgCnt3.Text = " * " + Session["txta3"].ToString();
                        PsgCnt3.Visible = true;
                    }



                    string fDate, tDate;
                    string []str=new string[10];
                    str =  lblFromDate.Text.Split('/');
                    string fd, fm, fy;
                    fd = str[0];
                    fm = str[1];
                    fy = str[2];

                    fDate = fm + "/" + fd + "/" + fy;

                    string[] str1 = new string[10];
                    str1 = lblToDate.Text.Split('/');
                    string  td, tm, ty;
                    td = str1[0];
                    tm = str1[1];
                    ty = str1[2];

                    tDate = tm + "/" + td + "/" + ty;


                    DateTime frmDate, toDate;

                    frmDate = DateTime.Parse(fDate);

                    toDate = DateTime.Parse(tDate);

                    System.TimeSpan diffResult = toDate.Subtract(frmDate);

                    lblNights.Text = diffResult.Days.ToString();

                    Session["Nights"] = diffResult.Days.ToString();

                   // string a, b,c;

                   //a= String.Format("{0:MM/dd/yyyy}", lblFromDate.Text.Trim());

                   //b= String.Format("{0:MM/dd/yyyy}", lblToDate.Text.Trim());

                   //c = String.Format("{0:MM/dd/yyyy}", DateTime.Now);

                }

            }



            void HttpSOAPAvailablity(String xml_request, string proxy)
            {

                XmlDocument doc = new XmlDocument();

                doc.Load(@"F:\SoapHeaderClient\SoapHeaderClient\" + xml_request);
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://212.170.239.71/appservices/http/FrontendService");


                if (proxy != null) req.Proxy = new WebProxy(proxy, true);
                // if SOAPAction header is required, add it here...


                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();
                doc.Save(stm);
                stm.Close();


                HttpWebResponse resp = (HttpWebResponse)req.GetResponse();


                stm = resp.GetResponseStream();

                if (resp.StatusCode == HttpStatusCode.OK)
                {


                    //DataSet datas = new DataSet();
                    //datas.ReadXml(stm);
                    //GridView1.DataSource = datas.Tables["ServiceInfo"];
                    //GridView1.DataBind();


                    //Stream stm1 = resp.GetResponseStream();
                    StreamReader r = new StreamReader(stm, enc);

                    // process SOAP return doc here. For now, we'll just send the XML out to the browser ...

                    string tmp = r.ReadToEnd();

                    tmp = tmp.Replace("http://www.hotelbeds.com/schemas/2005/06/messages", "");

                    XmlDocument xdoc = new XmlDocument();

                    xdoc.LoadXml(tmp.ToString());


                    //xdoc.Load(@"E:\SoapHeaderClient\SoapHeaderClient\Availability.xml");



                    XmlNodeList xNode2nd = xdoc.DocumentElement.SelectNodes("ServiceHotel/AvailableRoom");

                    GetRooms(xNode2nd);

                    XmlNodeList xNode3rd = xdoc.DocumentElement.SelectNodes("ServiceHotel/HotelInfo/ImageList/Image");

                    GetImages(xNode3rd);
                  

                    XmlNodeList xNodelst = xdoc.DocumentElement.SelectNodes("ServiceHotel");

                    GetHotels(xNodelst);


                    this.GridView1.DataSource = objHotelInfo;

                    this.GridView1.DataBind();

                }

            }


            public System.Data.DataTable GetHotels(XmlNodeList xNodelst1)
            {

             
             
                //Create three columns with string as their type

                objHotelInfo.Columns.Add("HotelCode", string.Empty.GetType());

                objHotelInfo.Columns.Add("Name", string.Empty.GetType());

                objHotelInfo.Columns.Add("CategoryCode", string.Empty.GetType());

                objHotelInfo.Columns.Add("Zone", string.Empty.GetType());



                //Create a new DataTable object
                foreach (XmlNode xNode in xNodelst1)
                {

                    string code, name, category,zone;
                    code = xNode.SelectSingleNode("HotelInfo/Code").InnerText;
                    name = xNode.SelectSingleNode("HotelInfo/Name").InnerText;
                    category = xNode.SelectSingleNode("HotelInfo/Category").InnerText;
                    zone = xNode.SelectSingleNode("HotelInfo/Destination/ZoneList/Zone").InnerText;
                    objHotelInfo.Rows.Add(new string[]
                        {
                    code, name, category,zone
                                 
                });



                }

                 
                    return objHotelInfo;


               }


            public System.Data.DataTable GetRooms(XmlNodeList xNode2nd1)
            {

              
                           
              
                //Create three columns with string as their type

              
                //objAvailableRooms.Columns.Add("HotelCode", string.Empty.GetType());

                objAvailableRooms.Columns.Add("Board", string.Empty.GetType());

                objAvailableRooms.Columns.Add("ShortName", string.Empty.GetType());

                objAvailableRooms.Columns.Add("RoomType", string.Empty.GetType());

                objAvailableRooms.Columns.Add("Amount", string.Empty.GetType());

                objAvailableRooms.Columns.Add("HotelCode", string.Empty.GetType());

                objAvailableRooms.Columns.Add("SHRUI", string.Empty.GetType());


                objAvailableRooms.Columns.Add("HotelName", string.Empty.GetType());

                objAvailableRooms.Columns.Add("Zone", string.Empty.GetType());


                //roomCount.Text = roomCount.Text + xNode.SelectSingleNode("AvailableRoom/HotelOccupancy/RoomCount").InnerText;
                //AdultCount.Text = AdultCount.Text + xNode.SelectSingleNode("AvailableRoom/HotelOccupancy/Occupancy/AdultCount").InnerText;
                //ChildCount.Text = ChildCount.Text + xNode.SelectSingleNode("AvailableRoom/HotelOccupancy/Occupancy/ChildCount").InnerText;
                //HotelRoomAvailCount.Text = HotelRoomAvailCount.Text + xNode.SelectSingleNode("AvailableRoom/HotelRoom").Attributes["availCount"].InnerText;
                //HotelRoomOnRequest.Text = HotelRoomOnRequest.Text + xNode.SelectSingleNode("AvailableRoom/HotelRoom").Attributes["onRequest"].InnerText;
                //HotelBoard.Text = HotelBoard.Text + xNode.SelectSingleNode("AvailableRoom/HotelRoom/Board").InnerText;
                //HotelRoom.Text = HotelRoom.Text + xNode.SelectSingleNode("AvailableRoom/HotelRoom/RoomType").InnerText;
                //price.Text = price.Text + xNode.SelectSingleNode("AvailableRoom/HotelRoom/Price/Amount").InnerText;


                //Create a new DataTable object
                foreach (XmlNode xNode1 in xNode2nd1)
                {

                    string room, adult, child, roomavail, status, board, roomtype, amount,code,shortname,shrui,name,zone;

                    //a = xNode.SelectSingleNode("HotelInfo/Code").InnerText;


                

                    //foreach (XmlNode xNode1 in xNode3rd1)
                    //{

                        board =  xNode1.SelectSingleNode("HotelRoom/Board").InnerText;
                        shortname = xNode1.SelectSingleNode("HotelRoom/Board").Attributes["shortname"].InnerText;
                        roomtype = xNode1.SelectSingleNode("HotelRoom/RoomType").InnerText;
                        amount = xNode1.SelectSingleNode("HotelRoom/Price/Amount").InnerText;
                        code = xNode1.ParentNode.SelectSingleNode("HotelInfo/Code").InnerText;
                        shrui = xNode1.SelectSingleNode("HotelRoom").Attributes["SHRUI"].InnerText;
                        name = xNode1.ParentNode.SelectSingleNode("HotelInfo/Name").InnerText;
                        zone = xNode1.ParentNode.SelectSingleNode("HotelInfo/Destination/ZoneList/Zone").InnerText;
                        objAvailableRooms.Rows.Add(new string[]
                        {
                        board,shortname,roomtype,amount,code,shrui,name,zone
                                 
                   });

                    //}



                }

                //this.GridView2.DataSource = objAvailableRooms;

                //this.GridView2.DataBind();

                return objAvailableRooms;


            }


            public System.Data.DataTable GetImages(XmlNodeList xNode3rd1)
            {



                         

                //Create three columns with string as their type



                objImages.Columns.Add("Images", string.Empty.GetType());

                objImages.Columns.Add("HotelCode", string.Empty.GetType());


           

                //Create a new DataTable object
                foreach (XmlNode xNode2 in xNode3rd1)
                {

                    string image, code;

                    //a = xNode.SelectSingleNode("HotelInfo/Code").InnerText;




                    //foreach (XmlNode xNode1 in xNode3rd1)
                    //{

                    image = xNode2.SelectSingleNode("Url").InnerText;
                    code = xNode2.ParentNode.ParentNode.SelectSingleNode("Code").InnerText;
                    objImages.Rows.Add(new string[]
                        {
                         image,code
                                 
                   });

                    //}



                }

                //this.GridView3.DataSource = objImages;

                //this.GridView3.DataBind();

                return objImages;


            }

            protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

            {

             


                    if (e.Row.RowType == DataControlRowType.DataRow)
                    {
                        string  i;
                        i = ((GridView)sender).DataKeys[e.Row.RowIndex].Value.ToString();

                          //objAvailableRooms.Select("HotelCode="+i);
                        //objAvailableRooms.Select("HotelCode="+i);

                        //System.Data.DataTable objRooms = new System.Data.DataTable();

                        //objRooms.DefaultView.RowFilter(objAvailableRooms.Select("HotelCode=" + i);

                        GridView grdChild = (GridView)e.Row.FindControl("GridView2");

                        DataView myView = ((DataTable)objAvailableRooms).DefaultView;
                        //myView.RowFilter = "Description LIKE '%" + strSearch.Text +
                        //"%' or Model LIKE '%" + strSearch.Text + "%' ";
                        myView.RowFilter = "HotelCode ='" + i+"'";


                        grdChild.DataSource = myView;
                        grdChild.DataBind();


                        DataList imgChild = (DataList)e.Row.FindControl("DataList1");



                        DataView myView1 = ((DataTable)objImages).DefaultView;
                        //myView.RowFilter = "Description LIKE '%" + strSearch.Text +
                        //"%' or Model LIKE '%" + strSearch.Text + "%' ";
                        myView1.RowFilter = "HotelCode ='" + i + "'";


                        imgChild.DataSource = myView1;
                        imgChild.DataBind();



                    }


             



                


                //this.GridView2.DataSource = objAvailableRooms;

                //this.GridView2.DataBind();

                
     


            }

            protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
            {


                if ((e.Item.ItemType == ListItemType.AlternatingItem | e.Item.ItemType == ListItemType.Item))
                {

                    string fileName = Convert.ToString(((DataRowView)e.Item.DataItem).Row.ItemArray[0].ToString().Trim());


                   
                    System.Web.UI.HtmlControls.HtmlImage img = (System.Web.UI.HtmlControls.HtmlImage)e.Item.FindControl("imgList");

                    img.Style.Add("cursor", "pointer");
                    img.Src = fileName;
                 

                    //Dim fullImageURL = Request.ApplicationPath & "/Photos/" & fileName
                    //img.Attributes.Add("onmouseover", "displayFullImage('" & img.ClientID & "', '" & fullImageURL & "')")
                    //img.Attributes.Add("onmouseout", "displaySmallImage('" & img.ClientID & "', '" & fullImageURL & "')")


                }



            }


            protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)

            {


                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    string board = Convert.ToString(((DataRowView)e.Row.DataItem).Row.ItemArray[0].ToString().Trim());

                    string sName = Convert.ToString(((DataRowView)e.Row.DataItem).Row.ItemArray[1].ToString().Trim());

                    string rType = Convert.ToString(((DataRowView)e.Row.DataItem).Row.ItemArray[2].ToString().Trim());

                    string amt = Convert.ToString(((DataRowView)e.Row.DataItem).Row.ItemArray[3].ToString().Trim());

                    string hotel = Convert.ToString(((DataRowView)e.Row.DataItem).Row.ItemArray[6].ToString().Trim());

                    string zone = Convert.ToString(((DataRowView)e.Row.DataItem).Row.ItemArray[7].ToString().Trim());


                    ImageButton imgBtn = (ImageButton)e.Row.FindControl("ImageButton1");

                    string str = board + "/" + sName + "/" + rType + "/" + amt + "/" + hotel + "/" + zone;

                    imgBtn.CommandArgument = str;


                }









              
            }

            //protected void imgBtn_Click(object sender, ImageClickEventArgs e)
            //{
              
            
            //    Response.Redirect("Basket.aspx");
            //}

          
            protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
            {

                string currentCommand = e.CommandName;

                if (currentCommand.Equals("Add"))
                {


                    string currentData = Convert.ToString (e.CommandArgument);

                    Session["Data"] = currentData;

                        Response.Redirect("Basket.aspx");


                }


             
            }

            protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
            {

                Response.Redirect("Home.aspx");
            }

        

                 



            }
        }




    these are the code for xml integration .is there any other idea for xml integration....now we are doing xml nodes .its very lengthy pls check it

    Monday, August 2, 2010 4:21 AM

Answers

All replies

  • User-1315824907 posted

    http://articles.techrepublic.com.com/5100-10878_11-1045137.html

    http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/dbxml/

    http://code.msdn.microsoft.com/SQLModCTPMXml

     

    Try these websites,,,,,,,,,,,, These helps in decresing the length of the code.............

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 2, 2010 5:45 AM
  • User3866881 posted

    If necessary, you can use LINQ to shorten your xml analyses...

    Please refer to this basic torturials: http://msdn.microsoft.com/en-au/library/bb387098.aspx

    Monday, August 2, 2010 9:59 PM
  • User1239365568 posted

    Hi asishvthomas,

    can you please tell me how did u make paging on hostellisting page grid..please help me for paging.

    Thanks

    Sunday, July 24, 2011 12:47 PM
  • User806868420 posted

    Hello asishvthomas

     

    i recently joined 1 company and i have the project to inplement the hotelbeds xml api using asp.net can you help me this

    ples i am very new to xml as i don't no ow to get the countryids and destinations tables in sql and how to create

     

     

    thanks

    Sunday, October 7, 2012 1:37 PM
  • User1239365568 posted

    Hi mdaslam,

    hotelbeds will give you the database tables for countryid and destination,just bind the data to control.you can use dropdownlist for this purpose.

    Thanx

    Monday, October 8, 2012 6:10 AM
  • User806868420 posted

    Hello Rizwan Ansari

    thanks for your reply i requested to hotelbeds they given me the xml and i implemented coz of your reply

    i am facing the problem of parsing the soap response xml do you have any idea how to parse using LINQ to xml

    i ask this same to hotelbeds they said that i only have to do parsing in asp.net c#

    i don't no how to do if you have any idea please can you share me i be very thankfu

     

    thanks

     

     

    Monday, October 8, 2012 10:08 AM
  • User1239365568 posted

    Hello mdaslam,

    are you able to get the response from hotelbeds,you can send the http request with the xml string and get the response in dataset.

    like ds.readxml(response).

    Thanx

    Tuesday, October 9, 2012 1:43 AM
  • User-179079940 posted

    aspx.cs page

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Xml;
    using System.Data;

    public partial class About : System.Web.UI.Page
    {

        public static string name;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                bindlist(); //call method
                Button1.Visible = true; //Insert Button
                Button4.Visible = false; //Update Button
            }
        }
        protected void Button1_Click(object sender, EventArgs e) //Inser Part
        {
            XmlDocument kaushik = new XmlDocument();      //Document object
            kaushik.Load(Server.MapPath("database.xml")); //Load Document
            XmlElement parentelement = kaushik.CreateElement("comments"); // created second Root Node
            XmlElement name = kaushik.CreateElement("name"); //child Node
            name.InnerText = txtname.Text;
            XmlElement location = kaushik.CreateElement("location");  //child Node
            location.InnerText = txtlocation.Text;
            XmlElement email = kaushik.CreateElement("email");  //child Node
            email.InnerText = txtemail.Text;
            XmlElement description = kaushik.CreateElement("comment");  //child Node
            description.InnerText = txtcomment.Text;
            XmlElement date = kaushik.CreateElement("date");  //child Node
            date.InnerText = Convert.ToString(DateTime.Now);
            parentelement.AppendChild(name); //Insert child node In Document
            parentelement.AppendChild(location);  //Insert child node In Document
            parentelement.AppendChild(email);  //Insert child node In Document
            parentelement.AppendChild(description);  //Insert child node In Document
            parentelement.AppendChild(date);  //Insert child node In Document
            kaushik.DocumentElement.AppendChild(parentelement);
            kaushik.Save(Server.MapPath("database.xml")); //Save Documnet
            using (xmlTableAdapters.xmlMasterTableAdapter xml = new xmlTableAdapters.xmlMasterTableAdapter()) //Insert node In Database
            {
                xml.Insert(txtname.Text, txtlocation.Text, txtemail.Text, txtcomment.Text, DateTime.Now);// Insert Statement
            }
            bindlist(); //Call Method
        }
        public void bindlist() //Display Part
        {
            XmlDataSource1.DataBind(); //Bind xmldatasource
            DataList1.DataBind(); //Bind Datalist


        }
        protected void Button2_Click(object sender, EventArgs e) //Fetch Old Data
        {
            name = ""; //Local Variable
            Button btn = (Button)(sender); //button object
            Button1.Visible = false; //Insert Button
            Button4.Visible = true;  //Update button
            using (xmlTableAdapters.xmlMasterTableAdapter xml = new xmlTableAdapters.xmlMasterTableAdapter()) //fetch Updated Data
            {
                DataTable dt = xml.GetDataBy(btn.CommandArgument); //Get data By Email Node
                if (dt.Rows.Count > 0)
                {
                    txtname.Text = dt.Rows[0]["Name"].ToString(); //assign name node text to textbox
                    txtlocation.Text = dt.Rows[0]["Location"].ToString(); //assign location node text to textbox
                    txtemail.Text = dt.Rows[0]["Email"].ToString(); //assign Email node text to textbox
                    name = dt.Rows[0]["Email"].ToString(); ////assign Email node text to Variable
                    txtcomment.Text = dt.Rows[0]["Comment"].ToString();  //assign Comment node text to textbox
                }
            }
        }
        protected void Button3_Click(object sender, EventArgs e) //Delete part
        {
            Button btn = (Button)(sender); //button object
            XmlDocument kaushik = new XmlDocument();  //Document object
            kaushik.Load(Server.MapPath("database.xml"));  //Load Document
            XmlNodeList list = kaushik.SelectNodes("//CommentsInformation/comments[email='" + btn.CommandArgument + "']"); //select nodes By Email
            XmlNode root = kaushik.DocumentElement; //Node Object
            root.RemoveChild(list[0]);  //Remove Node


            kaushik.Save(Server.MapPath("database.xml")); //Save Document
            using (xmlTableAdapters.xmlMasterTableAdapter xml = new xmlTableAdapters.xmlMasterTableAdapter()) //Delete To node in Database
            {
                xml.DeleteQuery(btn.CommandArgument);  //Delete Statement
            }
            bindlist(); //Call Method
        }
        protected void Button4_Click(object sender, EventArgs e) //Update Part
        {
            XmlDocument kaushik = new XmlDocument();  //Document Object
            kaushik.Load(Server.MapPath("database.xml")); //Load Document
            XmlNodeList list = kaushik.SelectNodes("//CommentsInformation/comments[email='" + name + "']"); //Select Node By Email
            list[0].ChildNodes[0].InnerText = txtname.Text; //Update name Node
            list[0].ChildNodes[1].InnerText = txtlocation.Text; //Update location Node
            list[0].ChildNodes[2].InnerText = txtemail.Text;  //Primary Node
            list[0].ChildNodes[3].InnerText = txtcomment.Text;  //Update comment Node
            list[0].ChildNodes[4].InnerText = Convert.ToString(DateTime.Now); //Update Date Node
            kaushik.Save(Server.MapPath("database.xml")); //Save Document
            using (xmlTableAdapters.xmlMasterTableAdapter xml = new xmlTableAdapters.xmlMasterTableAdapter()) //Update in Database
            {
                xml.UpdateQuery(txtname.Text, txtlocation.Text, txtcomment.Text, DateTime.Now, name); //Update Statement
            }

            bindlist(); //Call method
        }
    }

    aspx page

    <%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
        CodeFile="About.aspx.cs" Inherits="About" %>

    <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    </asp:Content>
    <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
        <table>
            <tr>
                <td>
                    Name
                </td>
                <td>
                    :
                </td>
                <td>
                    <asp:TextBox ID="txtname" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Location
                </td>
                <td>
                    :
                </td>
                <td>
                    <asp:TextBox ID="txtlocation" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Email
                </td>
                <td>
                    :
                </td>
                <td>
                    <asp:TextBox ID="txtemail" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Comment
                </td>
                <td>
                    :
                </td>
                <td>
                    <asp:TextBox ID="txtcomment" TextMode="MultiLine" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                </td>
                <td>
                    <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />
                    <asp:Button ID="Button4" runat="server" Text="Update" OnClick="Button4_Click" />
                </td>
            </tr>
            <tr>
                <td colspan="3" height="10">
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    <asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1"> <%--Bind Datalist Using Xml Datasource--%>
                        <ItemTemplate>
                            <table>
                                <tr>
                                    <td>
                                        Name
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        <%#XPath("name") %> <%--Document node--%>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Location
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        <%#XPath("location")%> <%--Document node--%>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        E-mail
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        <%#XPath("email")%> <%--Document node--%>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Comment
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        <%#XPath("comment")%> <%--Document node--%>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Date
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        <%#XPath("date")%> <%--Document node--%>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                        <asp:Button ID="Button2" runat="server" Text="Edit" OnClick="Button2_Click" CommandArgument='<%#XPath("email") %>' /> <%--Update Button--%>
                                        <asp:Button ID="Button3" runat="server" Text="Delete" OnClick="Button3_Click" CommandArgument='<%#XPath("email") %>' /> <%--Delete Button--%>
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <br />
                        </ItemTemplate>
                    </asp:DataList>
                    <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="database.xml" XPath="//CommentsInformation/comments"> <%--XML Datasource--%>
                    </asp:XmlDataSource>
                </td>
            </tr>
        </table>
    </asp:Content>

    Tuesday, October 9, 2012 3:51 AM
  • User806868420 posted

    Hello Rizwan

    Yes i am able to send request and recieve the response i am facing the difficulties of parsing the response

    tomm insha allah i will try what u said in your reply and tell you the details

     

    thanks

    Tuesday, October 9, 2012 1:14 PM
  • User806868420 posted

    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

    Friday, October 12, 2012 7:31 AM
  • User1239365568 posted

    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);
    }
    
    }
    Saturday, October 13, 2012 6:36 AM
  • User806868420 posted

    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 scenerio

    Room 1: 2 Adult = Child 0
    Room 2: 2 Adult = Child 2 Age is 3 years

    how can i give like thiscan you help me regarding this

    thanks

    Thursday, November 29, 2012 2:11 AM
  • User806868420 posted

    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 scenerio
    Room 1: 2 Adult = Child 0 Room 2: 2 Adult = Child 2 Age is 3 years
    how can i give like thiscan you help me regarding this
    Wednesday, August 21, 2013 12:50 PM