I’m writing a windows application which intern talks to a web interface
exposed at
http://194.224.184.162/barceloDS/interface/xml . Now my problem
is, this exposed interface will accept the XML String as parameter and
returns data in XML Format. You can find the example of the XML Input, at
http://194.224.184.162/barceloDS/interface/example, which explains in detail
about the input XML String.
I’m trying to execute the following code, which returning me null text,
instead of some response. Correct me where I’m mistaken.
string GetResp()
{
// This is the XML Input String to the exposed XML Interface
string strReq = @"<?xml version=""1.0"" encoding=""UTF-8""
?><barceloDS_requests><request type=""availability list"" id=""1"">
<session_id></session_id> <language_code>ING</language_code> <agency>
<primary>888</primary> <secondary>88</secondary> <detail>888</detail>
<branch>1</branch> </agency> <contract></contract>
<check_in_date>20060801</check_in_date>
<check_out_date>20060803</check_out_date> <location>
<destination_code>PMI</destination_code> <zone_code></zone_code> </location>
<establishment> <code></code> <category></category> </establishment>
<board_type_code></board_type_code> <occupancy> <adults>2</adults>
<children>1</children> <rooms>1</rooms> </occupancy> </request>
</barceloDS_requests>";
HttpWebRequest hwrRequest = (HttpWebRequest)
HttpWebRequest.Create("http://194.224.184.162/barceloDS/interface/xml");
hwrRequest.Method="POST";
hwrRequest.ContentType = "text/xml";
UTF8Encoding encoding = new UTF8Encoding();
byte[] postBytes = encoding.GetBytes(strReq);
hwrRequest.ContentLength=postBytes.Length;
Stream postStream = hwrRequest.GetRequestStream();
postStream.Write(postBytes,0,postBytes.Length);
postStream.Close();
HttpWebResponse hwrResponse = (HttpWebResponse) hwrRequest.GetResponse();
Stream responseStream = hwrResponse.GetResponseStream();
XmlTextReader xtrSmp = new XmlTextReader(responseStream);
string strXm = xtrSmp.ReadInnerXml();
xtrSmp.Close();
hwrResponse.Close();
return strXm;
}
Regards,
--
Every thing is perfect, as long as you share!!!