I have a strange problem when i call a webservice like this in my
navigator :
http://xxxxxxxx/xxxxxx/xxxx/users?mail=xx...@xxxx.fr&hash=e67bd01b34b2febcfe4140e5362173020f61b404&salt=sel&client=testapi&code=QPAylQEBXXsgasn9CIdJ7nsx0QU
that work, the web service send me information
but when i call with this C# code(simple test for the moment)
var client = new RestClient();
client.BaseUrl = "
http://xxxxxxxx/xxxxxx/xxxx";
//client.Authenticator = new
HttpBasicAuthenticator("username", "password");
var request = new RestRequest(Method.GET);
request.Resource = "users";
request.AddParameter("mail", "
xx...@xxxx.fr");
request.AddParameter("hash",
"e67bd01b34b2febcfe4140e5362173020f61b404");
request.AddParameter("salt", "sel");
request.AddParameter("__client", "testapi");
request.AddParameter("__code", "QPAylQEBXXsgasn9CIdJ7nsx0QU");
RestResponse response = client.Execute(request);
Response.Write(response.Content);
the web service, return "Unauthorized", this error is return when the
__code who is signature is not good, but these are the same parameters
But this code works :
RestResponse response = client.Execute(request);
//Response.Write(response.Headers);
Response.Write(response.Content);
Response.Write(HttpGet(
"
http://xxxxxxxx/xxxxxx/xxxx/users?
mail=
tes...@test.com&hash=7d2b6ab59c517b70dfd238f659fc67e2e5d23bb9&salt=sel&__client=testapi&__code=oVS13dGZe8sdH9OnZ6qovsGFcvI"
));
static string HttpGet(string url)
{
HttpWebRequest req = WebRequest.Create(url)
as HttpWebRequest;
string result = null;
using (HttpWebResponse resp = req.GetResponse()
as HttpWebResponse)
{
StreamReader reader =
new StreamReader(resp.GetResponseStream());
result = reader.ReadToEnd();
}
return result;
}
I asked the url the server is getting, but I do not know when I have
the answer...
Any idea?
Thank!
I already asked, but I do not know when I have the answer