Forum Discussion
Pradeep_Mogha_7
Nimbostratus
Nov 11, 2008Problem to call this web Method get_node_server_list()
Hi,
try to call this get_node_server_list() web Method. But it's give the error There is an error in XML document (17, 43). I am not understand this message. can any help me regard this. following code i am using for call that method.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Services.Description;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Security;
namespace ConsumeDummy
{
public class TrustAllCertificatePolicy : System.Net.ICertificatePolicy
{
public TrustAllCertificatePolicy()
{ }
public bool CheckValidationResult(ServicePoint sp,X509Certificate cert, WebRequest req, int problem)
{
return true;
}
}
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
//System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
System.Net.NetworkCredential objCredential = new System.Net.NetworkCredential("readonly", "readonly");
Node.ITCMLocalLBNode myNode = new Node.ITCMLocalLBNode();
System.Net.NetworkCredential myCred = new System.Net.NetworkCredential();
myNode.Url = "https://143.166.217.6:" + 443 + "/iControl/iControlPortal.cgi";
//Debug.WriteLine(myNode.Url);
// Turn on pre Auth?
myNode.PreAuthenticate = true;
// Credentials to connect (In Production we should use read only)
myCred.UserName = "readonly";
myCred.Password = "readonly";
// Pass credentials to the BigIP
myNode.Credentials = myCred;
// Empty the NodeList
NodeList.Items.Clear();
// Get List of Nodes
Node.ITCMCommonIPPortDefinition[] myNodeDefs = null;
myNodeDefs = myNode.get_node_server_list();
int[] myNodeStat = null;
myNodeStat = myNode.get_state_ex(myNodeDefs);
int i = 0;
for (i = 0; i <= myNodeDefs.Length; i++)
{
NodeList.Items.Add(myNodeDefs[ i ].address + ":" + myNodeDefs[ i ].port );
Console.WriteLine(myNodeDefs[ i ].address);
}
/*long l1, l2;
int s1;
l1 = (long)(IPAddressToNumber("10.166.218.79"));
l2 = 80;
node_Def.address = l1;
node_Def.port = l2;
long[] arrStr = new long[1000];
s1 = a1.get_availability(node_Def) ;
node_Def1=a1.get_node_server_list();
//s1=a1.get_state(node_Def);
//arrStr=a1.get_list();
//s1=a1.get_dynamic_ratio(l1);
Label1.Text = s1.ToString() ;
//Label1.Text = arrStr[0].ToString() ;
//node_Def1 = a1.get_node_server_list();
/*
Node.ITCMLocalLBNode myNode = new Node.ITCMLocalLBNode();
System.Net.NetworkCredential myCred = new System.Net.NetworkCredential();
if (string.IsNullOrEmpty(Hostname.Text)) {
Interaction.MsgBox("No Hostname Listed", MsgBoxStyle.Critical, "Error");
return;
}
// URL to BigIP
myNode.Url = "https://" + Hostname.Text + ":" + 443 + "/iControl/iControlPortal.cgi";
Debug.WriteLine(myNode.Url);
// Turn on pre Auth?
myNode.PreAuthenticate = true;
// Credentials to connect (In Production we should use read only)
myCred.UserName = Username.Text;
myCred.Password = Password.Text;
// Pass credentials to the BigIP
myNode.Credentials = myCred;
// Empty the NodeList
NodeList.Items.Clear();
// Get List of Nodes
Node.ITCMCommonIPPortDefinition[] myNodeDefs = null;
myNodeDefs = myNode.get_node_server_list;
int[] myNodeStat = null;
myNodeStat = myNode.get_state_ex(myNodeDefs);
int i = 0;
for (i = 0; i <= myNodeDefs.Length; i++) {
NodeList.Items.Add(myNodeDefs(i).address + ":" + myNodeDefs(i).port, Convert.ToBoolean(myNodeStat(i)));
Console.WriteLine(myNodeDefs(i).address);
}
*/
}
public double IPAddressToNumber(string IPaddress)
{
int i;
string [] arrDec;
double num = 0;
if (IPaddress == "")
{
return 0;
}
else
{
arrDec = IPaddress.Split('.');
for(i = arrDec.Length - 1; i >= 0 ; --i)
{
num += ((int.Parse(arrDec[ i ])%256) * Math.Pow(256 ,(3 - i )));
}
return num;
}
}
}
}
/*Imports System.Net.SecurityImports
* System.Security.Cryptography.X509Certificates2.before calling webservice:ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf customXertificateValidation)3.Custom certificate runnerrivate Shared Function customXertificateValidation(ByVal sender As Object, ByVal cert As X509Certificate, ByVal chain As X509Chain, ByVal Errora As SslPolicyErrors) As Boolean Return TrueEnd Function*/
Error Log i am attach in this Message....
I am waiting for your imp. reply becase My work is stuck because for that...
- I assume since you are using the ITCM* interfaces, that you are working with a v4.x version of BIG-IP. This forum is for v9.x of the product so if next time you could post to the v4.x forum, we'd appreciate it.
- Pradeep_Mogha_7
Nimbostratus
Thanks Joe for your reply,
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects