/// <summary> /// Generic XMLRPC client abstraction /// </summary> /// <param name="ReqParams">Hashtable containing parameters to the method</param> /// <param name="method">Method to invoke</param> /// <returns>Hashtable with success=>bool and other values</returns> private Hashtable genericCurrencyXMLRPCRequest(Hashtable reqParams, string method, string uri) { Console.WriteLine("[MONEY RPC]: genericCurrencyXMLRPCRequest: to {0}", uri); if (reqParams.Count<=0 || string.IsNullOrEmpty(method)) return null; if (m_checkServerCert) { if (!uri.StartsWith("https://")) { Console.WriteLine("[MONEY RPC]: genericCurrencyXMLRPCRequest: CheckServerCert is true, but protocol is not HTTPS. Please check INI file"); //return null; } } else { if (!uri.StartsWith("https://") && !uri.StartsWith("http://")) { Console.WriteLine("[MONEY RPC]: genericCurrencyXMLRPCRequest: Invalid Region Server URL: {0}", uri); return null; } } ArrayList arrayParams = new ArrayList(); arrayParams.Add(reqParams); XmlRpcResponse moneyServResp = null; try { //XmlRpcRequest moneyModuleReq = new XmlRpcRequest(method, arrayParams); //moneyServResp = moneyModuleReq.Send(uri, MONEYMODULE_REQUEST_TIMEOUT); NSLXmlRpcRequest moneyModuleReq = new NSLXmlRpcRequest(method, arrayParams); moneyServResp = moneyModuleReq.certSend(uri, m_cert, m_checkServerCert, MONEYMODULE_REQUEST_TIMEOUT); } catch (Exception ex) { Console.WriteLine("[MONEY RPC]: genericCurrencyXMLRPCRequest: Unable to connect to Region Server {0}", uri); Console.WriteLine("[MONEY RPC]: genericCurrencyXMLRPCRequest: {0}", ex.ToString()); Hashtable ErrorHash = new Hashtable(); ErrorHash["success"] = false; ErrorHash["errorMessage"] = "Failed to perform actions on OpenSim Server"; ErrorHash["errorURI"] = ""; return ErrorHash; } if (moneyServResp.IsFault) { Hashtable ErrorHash = new Hashtable(); ErrorHash["success"] = false; ErrorHash["errorMessage"] = "Failed to perform actions on OpenSim Server"; ErrorHash["errorURI"] = ""; return ErrorHash; } Hashtable moneyRespData = (Hashtable)moneyServResp.Value; return moneyRespData; }
/// <summary> /// Generic XMLRPC client abstraction /// </summary> /// <param name="ReqParams">Hashtable containing parameters to the method</param> /// <param name="method">Method to invoke</param> /// <returns>Hashtable with success=>bool and other values</returns> private Hashtable genericCurrencyXMLRPCRequest(Hashtable reqParams, string method) { //m_log.InfoFormat("[MONEY]: genericCurrencyXMLRPCRequest:"); if (reqParams.Count<=0 || string.IsNullOrEmpty(method)) return null; if (m_checkServerCert) { if (!m_moneyServURL.StartsWith("https://")) { m_log.InfoFormat("[MONEY]: genericCurrencyXMLRPCRequest: CheckServerCert is true, but protocol is not HTTPS. Please check INI file"); //return null; } } else { if (!m_moneyServURL.StartsWith("https://") && !m_moneyServURL.StartsWith("http://")) { m_log.ErrorFormat("[MONEY]: genericCurrencyXMLRPCRequest: Invalid Money Server URL: {0}", m_moneyServURL); return null; } } ArrayList arrayParams = new ArrayList(); arrayParams.Add(reqParams); XmlRpcResponse moneyServResp = null; try { NSLXmlRpcRequest moneyModuleReq = new NSLXmlRpcRequest(method, arrayParams); moneyServResp = moneyModuleReq.certSend(m_moneyServURL, m_cert, MONEYMODULE_REQUEST_TIMEOUT); } catch (Exception ex) { m_log.ErrorFormat("[MONEY]: genericCurrencyXMLRPCRequest: Unable to connect to Money Server {0}", m_moneyServURL); m_log.ErrorFormat("[MONEY]: genericCurrencyXMLRPCRequest: {0}", ex); Hashtable ErrorHash = new Hashtable(); ErrorHash["success"] = false; ErrorHash["errorMessage"] = "Unable to manage your money at this time. Purchases may be unavailable"; ErrorHash["errorURI"] = ""; return ErrorHash; } if (moneyServResp.IsFault) { Hashtable ErrorHash = new Hashtable(); ErrorHash["success"] = false; ErrorHash["errorMessage"] = "Unable to manage your money at this time. Purchases may be unavailable"; ErrorHash["errorURI"] = ""; return ErrorHash; } Hashtable moneyRespData = (Hashtable)moneyServResp.Value; return moneyRespData; }