Hi Marcelo,
I used code below, but I had the error says "The remote server
returned an error: (400) Bad Request." It means the call reached the
server, but since the request does not succeed, Do you think if there
are some security reasons prevent me from accessing or my credential
didn't match? Thank you in advance for your help.
WebRequest req = null;
WebResponse rsp = null;
try {
string xml = "<?xml version=\"1.0\" encoding=
\"UTF-8\"? ><auth_request><user><email>
j...@yourcause.com</
email><password>8005case</password></user><api_key>aada3015-2f84-4eab-
bf00-4d5315fe2b05</api_key></ auth_request>";
byte[] bytes =
System.Text.Encoding.ASCII.GetBytes(xml);
req.ContentLength = bytes.Length;
Stream outputStream = req.GetRequestStream();
outputStream.Write(bytes, 0, bytes.Length);
outputStream.Close();
rsp = req.GetResponse();
Stream MyStream = rsp.GetResponseStream();
StreamReader myStreamReader = new
StreamReader(MyStream);
myStreamReader.ReadToEnd().Trim();
}
catch (WebException ex) {
throw new WebException("Failed to get the request
stream.", ex);
}
catch (Exception e) {
throw new Exception("Failed to get the request
stream.", e);
}
finally {
if (req != null) req.GetRequestStream().Close();
if (rsp != null) rsp.GetResponseStream().Close();
}
Ellen