How to solve the error: The remote name could not be resolved: 'HostUrl'

Hi All,
I am new to ARAS and i try to get familiarized with its concepts.
In the current situation i try to connect two ARAS entities so they can send requests between each other (add, update, delete...)

I created a server event method on ARAS N°2 to send request to ARAS N°1 using the code below:

Innovator inn = this.getInnovator();
string myUrlAdress= "">hostOfAras1/.../anItemType";
var request = (HttpWebRequest)WebRequest.Create(myUrlAdress);
request.Method = "POST";
AuthenticateHeader(request);
string postData= "{\"_propretyOne\":\"ValueOne\",\"_propertyTwo\": \"valueTwo\"}";
var streamWriter = new StreamWriter(request.GetRequestStream());
streamWriter.Write(postData);
streamWriter.Flush();
streamWriter.Close();
return this;
}
private void AuthenticateHeader(WebRequest req)
{
req.Headers.Add("AUTHUSER", "admin");
req.Headers.Add("AUTHPASSWORD", "607920b64fe136f9ab2389e371852af2");
req.Headers.Add("DATABASE", "DataBaseOfAras1");
req.ContentType = "application/json";

When i run it i get the following error: The remote name could not be resolved: 'hostOfAras1' of type System.Net.WebException
NOTE: After some debug i noticed that the error is generated by this line of code " var streamWriter = new StreamWriter(request.GetRequestStream()); "

  • Hi Oussama,

    Have you tried connecting to the other Aras instance via IOM instead of the REST interface? For example, to get the first 100 parts from a remote Aras instance, something like this could work for you:

    [For some reason I cannot print http:// in the url, this site automatically makes a "> out of it. Hence, it is denoted here by [http : //]]

    const string url = "[http : //]localhost/InnovatorServer";
    const string db = "InnovatorSolutions";
    const string user = "admin";
    const string password = "innovator";
    var httpServerConnection = IomFactory.CreateHttpServerConnection(url, db, user, password);
    var loginResult = httpServerConnection.Login();
    if (loginResult.isError()) return loginResult;
    var remoteInnovator = IomFactory.CreateInnovator(httpServerConnection);
    var remoteParts = remoteInnovator.newItem("Part", "get");
    remoteParts.setAttribute("maxRecords", "100");
    remoteParts = remoteParts.apply();
    httpServerConnection.Logout();
    return this;

    Of course, you'd need to adjust the hostname (here "localhost"), the instance name (here "InnovatorServer"), database name, user and password according to your setup.

    If you need to use the REST API, you can find helpful blog posts here and here.

    Hope this helps,

    C

  • Hi Cogres i have tried this method but the problem is always the same.

  • Hmm, I doubt this is an Aras issue, then. It's probably got something to do with your setup of Aras servers/machines. Check out this article or something similar to investigate the source of the problem.