【问题标题】:updateUser in Cisco CUCM 11.5 via AXL in C#通过 C# 中的 AXL 在 Cisco CUCM 11.5 中更新用户
【发布时间】:2018-07-30 13:49:16
【问题描述】:

我是 C# 和 AXL 的新手,所以我试图通过 C# 中的 AXL 更新最终用户 PIN,但没有成功。我发现的一切都是this

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/8.5">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:updateUser sequence="?">
         <userid>enduser1</userid>
         <password>123456</password>
         <pin>123456</pin>
      </ns:updateUser>
   </soapenv:Body>
</soapenv:Envelope>

但是如何在 C# 中使用它呢?有 C# 的指南或代码 sn-p 吗?

【问题讨论】:

    标签: c# cucm cisco-axl


    【解决方案1】:

    非常简单地将 XML 字符串通过 HTTP 与 System.Net.Webclient 一起使用,您可以执行以下操作:

    using System.Net;
    using System;
    
    public class UpdateUser
    {
        static public void Main ()
        {
            ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true; //Install CUCM cert and remove this for production use
            WebClient client = new WebClient ();
            // Optionally specify an encoding for uploading and downloading strings.
            client.Encoding = System.Text.Encoding.UTF8;
            client.Headers.Add("Authorization","Basic QWRtaW5pc3RyYXRvcjpjaXNjb3BzZHQ=");
            client.Headers.Add("SOAPAction","CUCM:DB ver=11.5 updateUser");
            // Upload the data.
            string reply = client.UploadString ("https://ds-ucm115-1.cisco.com:8443/axl/","<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns='http://www.cisco.com/AXL/API/8.5'><soapenv:Header/><soapenv:Body><ns:updateUser><userid>dstaudt3</userid><password>password</password><pin>123456</pin></ns:updateUser></soapenv:Body></soapenv:Envelope>");
            // Disply the server's response.
            Console.WriteLine (reply);
        }
    }
    

    您可以通过 XML 文档编写器或使用 SOAP 编译器框架获得更花哨/更抽象的信息,但如果您的需求很简单,字符串操作往往会避免大量开销和复杂性...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      相关资源
      最近更新 更多