Author Topic: C# examples using CookComputing.XmlRpcV2.dll  (Read 22697 times)

cx2x3

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
    • Email
C# examples using CookComputing.XmlRpcV2.dll
« on: August 14, 2009, 15:12:02 »
Has anyone tried to get XmlRpc working in .Net ? .. I need some pointers and sample code just to get started .. do we need to install something on our server? or what would be the default location for this xmlrpc.do page?

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: C# examples using CookComputing.XmlRpcV2.dll
« Reply #1 on: August 17, 2009, 11:37:27 »
You can ask for the xmlrpc page as of http://server:8080/queuemetrics/xmlrpc.do - it's a virtual page, it does not exist on the filseystem!

sagar

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Re: C# examples using CookComputing.XmlRpcV2.dll
« Reply #2 on: August 17, 2009, 14:22:37 »
hi cx2x3

I have implemented a small code which implements xmlrpc server (web service) and xmlrpc client
in xmlrpc.net dll . no need to install anything on server ..ofcourse the web service will be on server ..
nut in code just add reference to cookcomputing.xmlrpc dll

:)

cx2x3

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
    • Email
Re: C# examples using CookComputing.XmlRpcV2.dll
« Reply #3 on: August 17, 2009, 15:48:27 »
Thanks all.. I am trying to call the QM.stats method

in the examples - they use an Java ArrayList .. if I use a C#/.Net ArrayList I get a "Parameter count mismatch." error

also tried to just change it to string but then I get another error...

Server returned a fault exception: [-1] redstone.xmlrpc.XmlRpcException: The method cannot be found. Signature: java.lang.String java.lang.String java.lang.String java.lang.String java.lang.String java.lang.String java.lang.String java.lang.String java.lang.String


has anyone got .net (VB or C#) code that works for this method (QM.stats)

cx2x3

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
    • Email
Re: C# examples using CookComputing.XmlRpcV2.dll
« Reply #4 on: August 18, 2009, 10:07:19 »
any help here guys?

I have enable my robot user and now i'm using robot to connect but still get the same errors?

Is it maybe something to do with the ArrayList that QM.stats expects as a the last parameter .. Is a .net ArrayList the same as a Java ArrayList ?

cx2x3

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
    • Email
Re: C# examples using CookComputing.XmlRpcV2.dll
« Reply #5 on: August 18, 2009, 10:14:19 »
this is the code I'm using .. maybe someone can spot the problem.. it crashes on the second last line where the call is made to GetStats

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using CookComputing.XmlRpc;

namespace AstrixMonitor
{
    [XmlRpcUrl("http://QueueMetricsServer:8080/QueueMetrics/xmlrpc.do")]
    public interface IQueueMetrics
    {
        [XmlRpcMethod("QM.stats")]
        Object GetStats(string queueNames,
                        string userName, string password,
                        string logfile, string period, // always leave these 2 X fields blank
                        string startOfPeriod, string endOfPeriod, //yyyy-mm-dd.hh.mm.ss (do not forget the dot between the date and the hour)
                        string agentFilter,
                        string analysisNames);
    }
 
    public partial class Monitor : Form
    {
        DataSet dsDropped;
        DataTable tblDropped;

        public Monitor()
        {
            InitializeComponent();
            GetData();
            dataGridView1.DataSource = dsDropped;
            dataGridView1.DataMember = "tblDropped";
        }

        private void GetData()
        {
            ArrayList analysisNames = new ArrayList();
            analysisNames.Add("KoDO.DiscCauses");
            //analysisNames.Add("CallDistrDO.AnsDistrPerDay");

            IQueueMetrics QueueMetrics = (IQueueMetrics)XmlRpcProxyGen.Create(typeof(IQueueMetrics));
            Object result = QueueMetrics.GetStats("9002", "robot", "robot", "", "",
                                                    "2009-08-12.00.00.00",
                                                        "2009-08-14.00.00.00", "", analysisNames.ToString());
            MessageBox.Show(result.ToString());


        }
    }
}

cx2x3

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
    • Email
Re: C# examples using CookComputing.XmlRpcV2.dll
« Reply #6 on: August 18, 2009, 11:11:53 »
OK I found the problem - XMLRPC doesn't like C#'s ArrayList - I changed it to a normal string array and now it works :-)

            string[] analysisNames = new string[] { "KoDO.DiscCauses", "CallDistrDO.AnsDistrPerDay"};

thanks!

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: C# examples using CookComputing.XmlRpcV2.dll
« Reply #7 on: August 18, 2009, 16:32:22 »
Cool man - by the way that's the way your XML-RPC library does the translation to the basic XML-RPC data types.