Hi There,

TL;DR I can’t get NWC-RPC to encode .NET object such as OpenMetaverse’s UUID or 
System.Net.IEndpoint - anyone know how to do this?

I am trying to get the NWC-RPC .NET module to communicate with my money server. 
The money server registers XML RPC calls with the grid like this:

m_httpServer.AddXmlRPCHandler("CancelTransfer", handleCancelTransfer)

The handleCanceTransfer’s signature looks like this:

 public XmlRpcResponse handleCancelTransfer(XmlRpcRequest request, IPEndPoint 
remoteClient)

My code looks like this (and it’s a copy/paste with a few tweaks from here):

using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using Nwc.XmlRpc;
using OpenMetaverse;
namespace Call_With_NWC
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            System.Net.ServicePointManager.CertificatePolicy = new 
ITrustAllCertificates();
            Hashtable ht = new Hashtable();
            ht["remoteClient"] = new IPEndPoint(IPAddress.Parse("192.168.0.1"), 
80);
            ht["secureCode"] = "code";
            ht["transactionID"] = UUID.Random(); // UUID Line
            Console.WriteLine("New GUID: " + ht["transactionID"]);
            List<Hashtable> parameters = new List<Hashtable> { ht };
            XmlRpcRequest request = new XmlRpcRequest("CancelTransaction", 
parameters);
            Hashtable response;
            try {
//                response = 
(Hashtable)request.Invoke("https://192.168.0.164:8008";);
                response = (Hashtable)request.Invoke("http://192.168.0.1:9000";);
                Console.WriteLine("It seems to have worked...");
                foreach (var key in response.Keys)
                {
                    Console.WriteLine("Key: " + key + " => " + response[key]);
                }
            } catch (Exception ex) {
                Console.WriteLine("Got an exception:\n" + ex.ToString());
            }
        }
    }
}

The money server consistently complains that the secureCode and UUID are empty 
- when in fact…they are…because I wrote up a little “Dump the request” server 
and get:

Message of length 348 was defined but not a blessed scalar.
<?xml version="1.0" encoding="utf-8"?>
<methodCall>
        <methodName>
                CancelTransaction
        </methodName>
        <params>
                <param>
                        <value>
                                <struct>
                                        <member>
                                                <name>
                                                        transactionID
                                                </name>
                                                <value/>
                                        </member>
                                        <member>
                                                <name>
                                                        remoteClient
                                                </name>
                                                <value/>
                                        </member>
                                        <member>
                                                <name>
                                                        secureCode
                                                </name>
                                                <value>
                                                        <string>
                                                                code
                                                        </string>
                                                </value>
                                        </member>
                                </struct>
                        </value>
                </param>
        </params>
</methodCall>

In fact, the NWC-XML-RPC is behaving as though it doesn’t know how to encode 
anything but plain strings. The transactionID should be the type 
OpenMetavers.UUID (which seems to be a wrapper around GUUID) and remoteClient 
should be an IEndPoint from System.Net.

Obviously I’m missing something but I’m not sure what.

How does one encode OpenMetaverse and other .NET objects so that the XML-RPC 
client on the other end is able to decode them?

DSL
_______________________________________________
Opensim-users mailing list
Opensim-users@opensimulator.org
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users

Reply via email to