[Mono-list] C#/Mono/CookComputing & xmlrpc2

Adam Williams awilliam@whitemice.org
Wed, 28 Jan 2004 21:04:53 -0500


I've been running back and forth trying to call OpenGroupware's xmlrpcd
from mono,  and then I found this message from The Man Helge himself -
http://lists.ximian.com/archives/public/mono-list/2003-November/016697.html
- and I'm curious if anyone has been able to get this to work? Or is
there still a bug in mono?

My test code is simple, and works for other XML-RPC servers, but when I
turn it on xmlrpcd I just get "crap", and 401 errors in the log.

Output in RPC server log - note 401 "authentication failed" code -
-----------------------------------------------------------------
192.168.1.20 - - [28/Jan/2004:03:43:34 GMT] "POST /RPC2 HTTP/1.1" 401 0
0.003 - - 0

Compiled via -
 mcs -r CookComputing.XmlRpc.dll test.cs opengroupwareServer.cs

test.cs
-----------------------------------------------------------------
using System.Net;
using System;

class Test {
  opengroupwareServer ogo;

  static void Main() {
    opengroupwareServer ogo = new opengroupwareServer("adam", "XXXXXX",
"SKYRiX");
    Console.WriteLine(ogo.getHostName());
   }
 }

opengroupwareServer.cs
-----------------------------------------------------------------
using CookComputing.XmlRpc;
using System.Net;
using System;

[XmlRpcUrl("http://kohocton/RPC2")]
class opengroupwareServer : XmlRpcClientProtocol
{
  public opengroupwareServer(string userName, string password, string
realm) {
    this.Credentials = new NetworkCredential(userName, password, realm);
   }
  
  [XmlRpcMethod("system.getHostname")]
  public string getHostName() {
    return (string)Invoke("getHostName");
   }
}
-------------------------------
Pukes, after a long pause, with -
[awilliam@estate2 mogo]$ mono test.exe
 
Unhandled Exception: System.Net.WebException: Error getting response
stream ---> System.Exception:
        at System.Net.WebConnection.HandleError()
        at System.Net.WebConnection.ReadDone()
        at System.MulticastDelegate.invoke_void_IAsyncResult()
        at System.Net.Sockets.Socket+Worker.End()
        at System.Net.Sockets.Socket+Worker.Receive()
in <0x000d5> System.Net.WebConnection:HandleError
(System.Net.WebExceptionStatus,System.Exception)
--- End of inner exception stack trace ---
 
in <0x00076> System.Net.HttpWebRequest:CheckFinalStatus
(System.Net.WebAsyncResult)
in <0x00065> (wrapper remoting-invoke-with-check)
System.Net.HttpWebRequest:CheckFinalStatus (System.Net.WebAsyncResult)
in <0x001c3> System.Net.HttpWebRequest:EndGetResponse
(System.IAsyncResult)
in <0x00092> System.Net.HttpWebRequest:GetResponse ()
in <0x00078>
System.Web.Services.Protocols.WebClientProtocol:GetWebResponse
(System.Net.WebRequest)
in <0x000ab>
System.Web.Services.Protocols.WebClientProtocol:GetWebResponse
(System.Net.WebRequest)
in <0x001c7> CookComputing.XmlRpc.XmlRpcClientProtocol:Invoke
(object,string,object[])
in <0x0001d> CookComputing.XmlRpc.XmlRpcClientProtocol:Invoke
(string,object[])
in <0x0006b> (wrapper remoting-invoke-with-check)
CookComputing.XmlRpc.XmlRpcClientProtocol:Invoke (string,object[])
in <0x00029> .opengroupwareServer:getHostName ()
in <0x00050> (wrapper remoting-invoke-with-check)
.opengroupwareServer:getHostName ()
in <0x00047> .Test:Main ()