C# Sample

1. HTTP RAW POST

C#
using System;
using System.IO;
using System.Net;

class MainClass
{
    public static void Main(string[] args)
    {
        string xmlMessage = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<OTA_HotelAvailNotifRQ>
    ...
</OTA_HotelAvailNotigRQ>";
        string url = "https://api.hotel-spider.com/ota/2014A/OTA_HotelAvailNotif";
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

        byte[] requestBytes = System.Text.Encoding.ASCII.GetBytes(xmlMessage);
        request.Method = "POST";
        request.ContentType = "text/xml;charset=utf-8";
        request.ContentLength = requestBytes.Length;
        Stream requestStream = request.GetRequestStream();
        requestStream.Write(requestBytes, 0, requestBytes.Length);
        requestStream.Close();

        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        StreamReader respStream = new StreamReader(response.GetResponseStream(), System.Text.Encoding.Default);
        string receivedResponse = respStream.ReadToEnd();
        Console.WriteLine(receivedResponse);
        respStream.Close();
        response.Close();
    }
}