AXL/SOAP を使用して、Cisco CUCM から Datagridview にデータを抽出するアプリケーションで忙しくしています。
情報をコンボボックスに入れると、データグリッドビューの最後のレコードのみが取得され、完全なリストが取得されます。AXL で抽出した情報は次のとおりです: SEP0014A815DB0D sk0000101 SEP0022555E7E26
これは私のコードです:
byte[] soapBytes = Encoding.UTF8.GetBytes(soap);
ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };
HttpWebRequest httpRQ = (HttpWebRequest)HttpWebRequest.Create(string.Format(@"https://XXX.XXX.XXX.XXX:8443/axl/"));
httpRQ.ProtocolVersion = System.Net.HttpVersion.Version10;
httpRQ.Credentials = new NetworkCredential("user1", "password");//Callmanager gebruikersnaam / password
httpRQ.Method = "POST";
httpRQ.ContentType = "text/xml; charset=utf-8";
httpRQ.Accept = "text/xml";
httpRQ.Headers.Add("SOAPAction: 'CUCM:DB ver=" + version + "'");
httpRQ.ContentLength = soapBytes.Length;
//Send the xml soap to cucm
Stream stm = httpRQ.GetRequestStream();
stm.Write(soapBytes, 0, soapBytes.Length);
stm.Close();
//Build the xml response
XDocument responcedoc = new XDocument();
HttpWebResponse responce = httpRQ.GetResponse() as HttpWebResponse;
Stream responcedata = responce.GetResponseStream();
StreamReader responsereader = new StreamReader(responcedata);
Logging.Text += "\n---------|AXL Response|---------\n\n";
XDocument respdoc = XDocument.Load(responsereader);
Logging.Text += respdoc + "\n";
soap = null;
//fill in the combo
DevicePhone.Items.Clear();
foreach (XElement item in respdoc.Descendants("name"))
{
// DataSet ds = new DataSet();
//ds.ReadXml((string)item);
DevicePhone.Items.Add((string)item);
string ds;
strDevicePhone = ((string)item);
ds = ((string)item);
label3.Text = strDevicePhone;
try
{
DataTable jmn = new DataTable("respdoc");
dataGridView1.DataSource = jmn;
jmn.Columns.Add("name");
jmn.Columns.Add("userid");
jmn.Rows.Add((string)item);
return;
}
catch (Exception e)
{
//Interaction.MsgBox(ex.ToString());
}
何が間違っているのか助けてください。