There is a service that accepts data as an Xml string.
I'm trying to send xml as a serialized string to this service, however I'm getting a 400 error code. What am I doing wrong?
My class for request:
public class AltoTrackClient
{
//private static string _url = "http://ws4.altotrack.com";
//private static string _action = "/WSPosiciones_WalmartMX/WSPosiciones_WalmartMX.svc?wsdl";
public static string ProcessXml(string xmlString)
{
HttpWebRequest request = (HttpWebRequest) WebRequest.Create("http://ws4.altotrack.com/WSPosiciones_WalmartMX/WSPosiciones_WalmartMX.svc?singleWsdl");
byte[] requestInFormOfBytes = System.Text.Encoding.UTF8.GetBytes(xmlString);
request.Method = "POST";
request.ContentType = "text/xml;charset=utf-8";
request.ContentLength = requestInFormOfBytes.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(requestInFormOfBytes,0, requestInFormOfBytes.Length);
requestStream.Close();
string recievedResponse;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.Default))
{
recievedResponse = reader.ReadToEnd();
}
}
return recievedResponse;
}
}