оставлю тут, вдруг кому пригодится:
Business connector кэширует данные, если было изменение класса, то можно почистить кэш,
Код:
axp = new Microsoft.Dynamics.BusinessConnectorNet.Axapta();
axp.Logon(null, null, null, null);
axp.CallStaticClassMethod("SysFlushAOD", "doFlush");
обращение к сервису из аксапты, получение JSON и конвертация в XML
Код:
boolean getInfo()
{
boolean ret;
str url = "http://url.url";
CLRObject clrCredential = null;
System.Net.NetworkCredential credential = null;
CLRObject clro = null;
System.Net.HttpWebRequest httpRequest = null;
System.Net.HttpWebResponse httpResponse = null;
System.IO.Stream stream = null;
System.IO.StreamReader streamReader = null;
System.Xml.Linq.XNode xnode = null;
System.Exception clrException;
str s;
;
try
{
new InteropPermission(InteropKind::ClrInterop).assert();
clrCredential = new System.Net.NetworkCredential();
credential = clrCredential;
credential.set_UserName("user_name");
credential.set_Password("user_pwd");
clro = System.Net.WebRequest::Create(url);
httpRequest = clro;
httpRequest.set_Credentials(credential);
httpResponse = httpRequest.GetResponse();
stream = httpResponse.GetResponseStream();
streamReader = new System.IO.StreamReader(stream);
s = streamReader.ReadToEnd();
if (s == "null" || s == "false")
{
info("No info");
ret = false;
}
else
{
xnode = Newtonsoft.Json.JsonConvert::DeserializeXNode(s, "Root");
s = xNode.ToString();
xmlDoc = new XMLDocument();
xmlDoc.loadXml(s);
CodeAccessPermission::revertAssert();
ret = true;
}
}
catch(Exception::CLRError)
{
clrException = CLRInterop::getLastException();
if (clrException)
{
clrException = clrException.get_InnerException();
if (clrException)
{
error(clrException.get_Message());
}
}
ret = false;
}
return ret;
}