Hello everyone,
I have recently got started in creating a web application to remotely start tasks (particularly programs, modules, anything like that) using Robot Web Services from ABB. I have seen the examples and tested them. My biggest issue is of course regarding REST services, the POST method.
For example, using the provided documentation for starting rapid execution (http://developercenter.robotst…execution_start_page.html), I have edited the preexisting examples for the GET method but to no avail. Whatever the programming language used (C#, nodejs, plain Javascript), or even only with Postman, I keep getting the same error:
Found nothing in the documentation and error handling about this.
Sample code I have tried in C#, using ASP.NET MVC, tested using Postman:
static string _post = "http://192.168.125.1"; //activate tasks
[System.Web.Http.HttpPost]
public async Task<HttpResponseMessage> PostAsync([FromBody]Model1 model)
{
var handler = new HttpClientHandler { Credentials = new NetworkCredential("Default User", "robotics") };
handler.Proxy = null;
handler.UseProxy = false;
HttpClient client = new HttpClient(handler) {
BaseAddress = new Uri(_post),
};
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "/rw/rapid/execution")
{
Content = new StringContent("{\"action\":\"" + model.Action + "\"}", Encoding.UTF8, "application/json")
};
var result = new HttpResponseMessage();
await client.SendAsync(request)
.ContinueWith(responseTask =>
{
result = responseTask.Result;
});
return result;
}
public class Model1
{
[Required]
public string Action { get; set; }
}
Display More
There are no examples, even remotely simple regarding these services and if anyone could help, I would greatly appreciate it.