cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
120
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: Sandeep Pulkundwar on 20-07-2010 03:43:11 PM
Hi,

We are devlopers of a resource booking system. Our client is having Tandberg system installed and we are developing software to booking Tandberg system when user books the conference room using our booking system. We are using Codian MCU 4205 and XML-RPC protocol in C#. We are getting an error when we try to communicate to Codian service. We have developed a sample Web application in C# and ASP.Net to test devide.query and cdrlog.query method. When we call methods we get an error  - Server returned a fault exception: [14] authorization failed.

Sample Web Application is having an interface ICodian in App_Code folder as below

############### ICodian Starts ##########################

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CookComputing.XmlRpc;
using System.Reflection;


/// <summary>
/// Summary description for ICodian
/// </summary>
[XmlRpcUrl("http://domain.com/rpc2")]
public interface ICodian: IXmlRpcProxy
{

    [CookComputing.XmlRpc.XmlRpcMethod("device.query")]
    string deviceQuery();

    [CookComputing.XmlRpc.XmlRpcMethod("cdrlog.query")]
    cdrlogqueryResponse cdrlogQuery();

  
}


public class cdrlogqueryResponse
{
    public int firstIndex;
    public int deleteableIndex;
    public int numEvents;
    public int percentageCapacity;
}
############### ICodian Ends  ##########################


Code in the Web Page code behind where we call XML-RPC service is as below .

############### Default.aspx.cs Starts ##########################
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CookComputing.XmlRpc;
using System.Net;
using System.Security.Cryptography.X509Certificates;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ICodian codianService = (ICodian)XmlRpcProxyGen.Create(typeof(ICodian));
        codianService.Credentials = new NetworkCredential("username", "password");
        codianService.UseEmptyParamsTag = true;
        codianService.KeepAlive = false;
        XmlRpcClientProtocol ClientProtocol = (XmlRpcClientProtocol)codianService;
        ClientProtocol.Url = "http://domain.com/rpc2";
        ClientProtocol.UseIndentation = true;
       
        try
        {
            if (codianService.deviceQuery() != null)
            {
                string ocdrlogqueryResponse = codianService.deviceQuery();
                Response.Write("Successfully pinged guest account.");
            }
        }
        catch (Exception Ex)
        {
            Response.Write(Ex.Message);
        }
    }
}
############### Default.aspx.cs End ##########################

Can you please let us know what is wrong/Missing in this code?

Thanks & Regards,
Sandeep

Subject: RE: Error while communicating to Codian MCU 4205 service in C#
Replied by: David Bruun-Lie on 20-07-2010 03:48:25 PM
Hi,
I am assuming that you have the correct username and password and are not literaly using ("username", "password"); in your code?

Regards,
David

Subject: RE: Error while communicating to Codian MCU 4205 service in C#
Replied by: Sandeep Pulkundwar on 20-07-2010 04:00:42 PM
Hi David,

Thanks for quick reply.

I am using correct username, password and URL in the application.
In sample code i used dummy, but in real code i am using correct username and password.

Thanks & Regards,
Sandeep

Subject: RE: Error while communicating to Codian MCU 4205 service in C#
Replied by: Luc Hands on 27-07-2010 06:17:04 PM
Hi,

I'm not entirely sure how the Cook Computing XMLRPC library works myself, but it looks like the "Credentials" attribute is to provide login details for HTTP authentication. The Codian MCU does not use HTTP authentication for the API, instead you need to supply 'authenticationUser' and 'authenticationPassword' parameters to every API function that you call. I can't see where in your code you're doing this, so that might explain why authentication is failing.

I would recommend running a wireshark trace of the API traffic your application is generating to the MCU, and comparing the resulting XML to the examples in the API specification document - if you don't see 'authenticationUser' and 'authenticationPassword' in the trace then that will explain your login problems.

Also, please ensure the user that you're using to test has Admin privileges to the MCU as described in the API specification document.

Thanks,

Luc

Subject: RE: Error while communicating to Codian MCU 4205 service in C#
Replied by: Malathi Sekkappan on 08-09-2010 05:14:09 PM
I am running into same problem.  How did you pass authenticationUser and authenticationPassword?
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links