From bc06db3df45d8dd61338c5b1426fd0161731f7cd Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 24 Apr 2014 14:21:05 +0300 Subject: - Created a standard function to send XML-RPC requests, which logs them like we do for other types of HTTP activity. - Changed OpenProfileClient to use the new XML-RPC sending function - Improved logging in WebUtil --- OpenSim/Services/Interfaces/OpenProfileClient.cs | 69 +++--------------------- 1 file changed, 6 insertions(+), 63 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Interfaces/OpenProfileClient.cs b/OpenSim/Services/Interfaces/OpenProfileClient.cs index 099b0c3..4126c35 100644 --- a/OpenSim/Services/Interfaces/OpenProfileClient.cs +++ b/OpenSim/Services/Interfaces/OpenProfileClient.cs @@ -35,7 +35,6 @@ using System.Reflection; using System.Text; using System.Xml; using log4net; -using Nwc.XmlRpc; using OpenMetaverse; using OpenSim.Framework; @@ -79,7 +78,12 @@ namespace OpenSim.Services.UserProfilesService Hashtable ReqHash = new Hashtable(); ReqHash["avatar_id"] = props.UserId.ToString(); - Hashtable profileData = GenericXMLRPCRequest(ReqHash, "avatar_properties_request", m_serverURI); + Hashtable profileData = XMLRPCRequester.SendRequest(ReqHash, "avatar_properties_request", m_serverURI); + + if (profileData == null) + return false; + if (!profileData.ContainsKey("data")) + return false; ArrayList dataArray = (ArrayList)profileData["data"]; @@ -128,66 +132,5 @@ namespace OpenSim.Services.UserProfilesService return true; } - - private Hashtable GenericXMLRPCRequest(Hashtable ReqParams, string method, string server) - { - ArrayList SendParams = new ArrayList(); - SendParams.Add(ReqParams); - - XmlRpcResponse Resp; - try - { - XmlRpcRequest Req = new XmlRpcRequest(method, SendParams); - Resp = Req.Send(server, 30000); - } - catch (WebException ex) - { - m_log.ErrorFormat("[PROFILE]: Unable to connect to Profile " + - "Server {0}. Exception {1}", server, ex); - - Hashtable ErrorHash = new Hashtable(); - ErrorHash["success"] = false; - ErrorHash["errorMessage"] = "Unable to fetch profile data at this time. "; - ErrorHash["errorURI"] = ""; - - return ErrorHash; - } - catch (SocketException ex) - { - m_log.ErrorFormat( - "[PROFILE]: Unable to connect to Profile Server {0}. Method {1}, params {2}. " + - "Exception {3}", server, method, ReqParams, ex); - - Hashtable ErrorHash = new Hashtable(); - ErrorHash["success"] = false; - ErrorHash["errorMessage"] = "Unable to fetch profile data at this time. "; - ErrorHash["errorURI"] = ""; - - return ErrorHash; - } - catch (XmlException ex) - { - m_log.ErrorFormat( - "[PROFILE]: Unable to connect to Profile Server {0}. Method {1}, params {2}. " + - "Exception {3}", server, method, ReqParams.ToString(), ex); - Hashtable ErrorHash = new Hashtable(); - ErrorHash["success"] = false; - ErrorHash["errorMessage"] = "Unable to fetch profile data at this time. "; - ErrorHash["errorURI"] = ""; - - return ErrorHash; - } - if (Resp.IsFault) - { - Hashtable ErrorHash = new Hashtable(); - ErrorHash["success"] = false; - ErrorHash["errorMessage"] = "Unable to fetch profile data at this time. "; - ErrorHash["errorURI"] = ""; - return ErrorHash; - } - Hashtable RespData = (Hashtable)Resp.Value; - - return RespData; - } } } -- cgit v1.1