Posted By Joe on 07/21/2010 12:01 PM
Did you compile the WSDL yourself and incorporate it into your application? If so, I'd recommend going with the iControl Assembly. Just plug the .Net assembly into your project and you don't have to muck around with all the lower level bindings. You can find that download in the iControl Assembly Labs project under the Download menu.
With that being said, I don't see anywhere in your class where you actually make the call. The "error in xml document" usually implies that the SOAP response is not well formed and I'm not sure of a case where that could happen unless there was an exception on the server and in that case you'd get a 500 error back.
Pass along the code you are using to call the methods and I'll try to reproduce your issue and/or provide you some sample code.
If it helps, I wrote a tech tip a while back on the performance graph interfaces and some sample code with PowerShell. The syntax is somewhat close to C so that may help you as well.
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/194/iControl-101--11--Performance-Graphs.aspx
-Joe
Thank you, Joe
I still don't know what do you mean by "compile the WSDL yourself and incorporate it into your application" and "Just plug the .Net assembly into your project ".
As the samples in icontrol sdk don't contain the statistics part, so I did it as the samples(such as "\sdk\samples\soap\c\microsoft\System\SystemInfo") do.
Following is the class(ClassSystemStatistics ) to call the interface defined in the class SystemStatistics.
In class ClassSystemStatistics, there are four interfaces. "GetPerformanceGraphList" and "GetPerformanceTableList" always have a run-time error, while the other two interfaces don't have.
using System;
using System.Collections.Generic;
using System.Text;
using Statistics;
namespace BackOfficeF5
{
class ClassSystemStatistics : System.Net.ICertificatePolicy
{
private System.Net.NetworkCredential creds = new System.Net.NetworkCredential();
private string m_strHostName = "";
private string m_strUserName = "";
private string m_strPassword = "";
private SystemStatistics mySystemStatistics = new SystemStatistics();
public ClassSystemStatistics(string sHostName, string sUserName, string sPassword)
{
this.m_strHostName = sHostName;
this.m_strUserName = sUserName;
this.m_strPassword = sPassword;
}
public PerformanceGraph[] GetPerformanceGraphList()
{
System.Net.ServicePointManager.CertificatePolicy = this;
mySystemStatistics.Credentials = creds;
mySystemStatistics.Url = "https://" + m_strHostName + "/iControl/iControlPortal.cgi";
creds.UserName = m_strUserName;
creds.Password = m_strPassword;
mySystemStatistics.PreAuthenticate = true;
try
{
PerformanceGraph[] myPerformanceGraph = mySystemStatistics.get_performance_graph_list();
return myPerformanceGraph;
}
catch (Exception e)
{
string str = e.Message;
return null;
}
}
public PerformanceTable[] GetPerformanceTableList()
{
System.Net.ServicePointManager.CertificatePolicy = this;
mySystemStatistics.Credentials = creds;
mySystemStatistics.Url = "https://" + m_strHostName + "/iControl/iControlPortal.cgi";
creds.UserName = m_strUserName;
creds.Password = m_strPassword;
mySystemStatistics.PreAuthenticate = true;
try
{
PerformanceTable[] myPerformanceTable = mySystemStatistics.get_performance_table_list();
return myPerformanceTable;
}
catch (Exception e)
{
string str = e.Message;
return null;
}
}
public string GetVersion()
{
System.Net.ServicePointManager.CertificatePolicy = this;
mySystemStatistics.Credentials = creds;
mySystemStatistics.Url = "https://" + m_strHostName + "/iControl/iControlPortal.cgi";
creds.UserName = m_strUserName;
creds.Password = m_strPassword;
mySystemStatistics.PreAuthenticate = true;
try
{
string strVersion = mySystemStatistics.get_version();
return strVersion;
}
catch (Exception e)
{
string str = e.Message;
return null;
}
}
public string[] GetListOfHosts()
{
System.Net.ServicePointManager.CertificatePolicy = this;
mySystemStatistics.Credentials = creds;
mySystemStatistics.Url = "https://" + m_strHostName + "/iControl/iControlPortal.cgi";
creds.UserName = m_strUserName;
creds.Password = m_strPassword;
mySystemStatistics.PreAuthenticate = true;
try
{
string[] myHosts = mySystemStatistics.get_list_of_hosts();
return myHosts;
}
catch (Exception e)
{
string str = e.Message;
return null;
}
}
region ICertificatePolicy Members
public bool CheckValidationResult(System.Net.ServicePoint srvPoint, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Net.WebRequest request, int certificateProblem)
{
return true;
}
endregion
}
}