[Opensim-users] NWC-RPC Methods Giving Odd Results
David Lloyd
lloy0076 at adam.com.au
Fri Nov 28 23:04:44 UTC 2014
The error given by the Money Server is:
Money # 04:57:46 - [MONEY RPC]: handleCancelTransfer: Exception occurred when transaction 94786877-9ed6-4d36-98d7-9a88f7b52acf: System.NullReferenceException: Object reference not set to an instance of an object
at OpenSim.Grid.MoneyServer.MoneyXmlRpcModule.handleCancelTransfer (Nwc.XmlRpc.XmlRpcRequest request, System.Net.IPEndPoint remoteClient) [0x00000] in <filename unknown>:0
This is because it’s attempting to dereference a string (if I do UUID.Random().ToString()) or an empty value.
DSL
> On 29 Nov 2014, at 9:30 am, David Lloyd <lloy0076 at adam.com.au> wrote:
>
>
> 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 <http://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 at opensimulator.org
> http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-users/attachments/20141129/0048dea0/attachment-0001.html>
More information about the Opensim-users
mailing list