You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1009 B
37 lines
1009 B
using Microsoft.AspNetCore.Mvc;
|
|
using Nwc.XmlRpc;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace IoTDameon.Controllers
|
|
{
|
|
public class HomeController : Controller
|
|
{
|
|
private IHttpClientFactory _httpClientFactory;
|
|
|
|
public HomeController(IHttpClientFactory httpClientFactory)
|
|
{
|
|
_httpClientFactory = httpClientFactory;
|
|
}
|
|
|
|
public IActionResult Index()
|
|
{
|
|
var client = new XmlRpcRequest();
|
|
client.MethodName = "supervisor.getState";
|
|
try
|
|
{
|
|
Console.WriteLine("Request: " + client);
|
|
var response = client.Send("http://usr:pwd@iot.edusoa.com:9001/RPC2");
|
|
Console.WriteLine("Response: " + response);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Content(ex.ToString());
|
|
}
|
|
return Content("");
|
|
}
|
|
}
|
|
} |