Hi,
I am new on ranorex, and I try to request an API web service, I tried to add a web reference, but I have no login or password, only a permanent token, how can I do that?
(Ranorex 8.0.1)
Request a Web Service with only token
Re: Request a Web Service with only token
Its hard to say without knowing more information about your example. the Web Reference functionality in Ranorex Studio is part of.NET framework and is not Ranorex specific as far as I know; have you been able to achieve what you are describing in another .NET IDE like Visual Studio?
Re: Request a Web Service with only token
Our API uses the OAuth token system, basically a custom header value that has to be added to the header of each request.
Code: Select all
public static HttpResponseMessage Post(string uri, string oAuthToken, string postJson) {
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken); // <-- Notice this line
HttpContent content = new StringContent(postJson, System.Text.Encoding.UTF8, "application/json");
return client.PostAsync(uri, content).Result;
}
}
Shortcuts usually aren't...
Re: Request a Web Service with only token
Thanks guys, I did it, it was very helpfull 
