Forum Discussion

Pradeep_Mogha_7's avatar
Pradeep_Mogha_7
Icon for Nimbostratus rankNimbostratus
Nov 11, 2008

Problem 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...

2 Replies

  • 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.

     

     

    As for your error. It's hard to tell what's going on but typically if you get an error stating that there is a problem with the XML document, that means that a response from the server is invalid meaning that there is a problem with the iControl service. To me, it doesn't look like a issue with the client code so it's a bit beyond what we can help with here. This is something that is beyond the support of the forums as we would need to have specific version testing for your environment. You are best off calling product support and creating a support ticket so that the support folks can try to recreate your error and then get you a fix.

     

     

    -Joe
  • Thanks Joe for your reply,

     

     

    Yes I am using ITCM* interfaces, I had no idea in which version I have to post this Question so I had submit in both versions :-) , Joe I am very new to using iControl services can you send me the link by where I can submit the TT for that Issue,

     

    I had try lot to change in code, Like this services expected result is return list of server address in string[] format, But it's return long[], I tried convertion like string[] to long[] vic- visa, but it' not work for me. suggest me what to do for resloved that problem

     

     

     

    Thanks

     

     

    Pradeep Mogha