diff options
author | Oren Hurvitz | 2014-04-24 14:21:05 +0300 |
---|---|---|
committer | Oren Hurvitz | 2014-04-24 15:58:43 +0100 |
commit | bc06db3df45d8dd61338c5b1426fd0161731f7cd (patch) | |
tree | 5df8409d6a24215e4c1df125b5176609fc7926ee /OpenSim/Services/Interfaces | |
parent | Changed how UserProfile performs a fallback call using the OpenProfile API, b... (diff) | |
download | opensim-SC_OLD-bc06db3df45d8dd61338c5b1426fd0161731f7cd.zip opensim-SC_OLD-bc06db3df45d8dd61338c5b1426fd0161731f7cd.tar.gz opensim-SC_OLD-bc06db3df45d8dd61338c5b1426fd0161731f7cd.tar.bz2 opensim-SC_OLD-bc06db3df45d8dd61338c5b1426fd0161731f7cd.tar.xz |
- 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
Diffstat (limited to 'OpenSim/Services/Interfaces')
-rw-r--r-- | OpenSim/Services/Interfaces/OpenProfileClient.cs | 69 |
1 files changed, 6 insertions, 63 deletions
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; | |||
35 | using System.Text; | 35 | using System.Text; |
36 | using System.Xml; | 36 | using System.Xml; |
37 | using log4net; | 37 | using log4net; |
38 | using Nwc.XmlRpc; | ||
39 | using OpenMetaverse; | 38 | using OpenMetaverse; |
40 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
41 | 40 | ||
@@ -79,7 +78,12 @@ namespace OpenSim.Services.UserProfilesService | |||
79 | Hashtable ReqHash = new Hashtable(); | 78 | Hashtable ReqHash = new Hashtable(); |
80 | ReqHash["avatar_id"] = props.UserId.ToString(); | 79 | ReqHash["avatar_id"] = props.UserId.ToString(); |
81 | 80 | ||
82 | Hashtable profileData = GenericXMLRPCRequest(ReqHash, "avatar_properties_request", m_serverURI); | 81 | Hashtable profileData = XMLRPCRequester.SendRequest(ReqHash, "avatar_properties_request", m_serverURI); |
82 | |||
83 | if (profileData == null) | ||
84 | return false; | ||
85 | if (!profileData.ContainsKey("data")) | ||
86 | return false; | ||
83 | 87 | ||
84 | ArrayList dataArray = (ArrayList)profileData["data"]; | 88 | ArrayList dataArray = (ArrayList)profileData["data"]; |
85 | 89 | ||
@@ -128,66 +132,5 @@ namespace OpenSim.Services.UserProfilesService | |||
128 | 132 | ||
129 | return true; | 133 | return true; |
130 | } | 134 | } |
131 | |||
132 | private Hashtable GenericXMLRPCRequest(Hashtable ReqParams, string method, string server) | ||
133 | { | ||
134 | ArrayList SendParams = new ArrayList(); | ||
135 | SendParams.Add(ReqParams); | ||
136 | |||
137 | XmlRpcResponse Resp; | ||
138 | try | ||
139 | { | ||
140 | XmlRpcRequest Req = new XmlRpcRequest(method, SendParams); | ||
141 | Resp = Req.Send(server, 30000); | ||
142 | } | ||
143 | catch (WebException ex) | ||
144 | { | ||
145 | m_log.ErrorFormat("[PROFILE]: Unable to connect to Profile " + | ||
146 | "Server {0}. Exception {1}", server, ex); | ||
147 | |||
148 | Hashtable ErrorHash = new Hashtable(); | ||
149 | ErrorHash["success"] = false; | ||
150 | ErrorHash["errorMessage"] = "Unable to fetch profile data at this time. "; | ||
151 | ErrorHash["errorURI"] = ""; | ||
152 | |||
153 | return ErrorHash; | ||
154 | } | ||
155 | catch (SocketException ex) | ||
156 | { | ||
157 | m_log.ErrorFormat( | ||
158 | "[PROFILE]: Unable to connect to Profile Server {0}. Method {1}, params {2}. " + | ||
159 | "Exception {3}", server, method, ReqParams, ex); | ||
160 | |||
161 | Hashtable ErrorHash = new Hashtable(); | ||
162 | ErrorHash["success"] = false; | ||
163 | ErrorHash["errorMessage"] = "Unable to fetch profile data at this time. "; | ||
164 | ErrorHash["errorURI"] = ""; | ||
165 | |||
166 | return ErrorHash; | ||
167 | } | ||
168 | catch (XmlException ex) | ||
169 | { | ||
170 | m_log.ErrorFormat( | ||
171 | "[PROFILE]: Unable to connect to Profile Server {0}. Method {1}, params {2}. " + | ||
172 | "Exception {3}", server, method, ReqParams.ToString(), ex); | ||
173 | Hashtable ErrorHash = new Hashtable(); | ||
174 | ErrorHash["success"] = false; | ||
175 | ErrorHash["errorMessage"] = "Unable to fetch profile data at this time. "; | ||
176 | ErrorHash["errorURI"] = ""; | ||
177 | |||
178 | return ErrorHash; | ||
179 | } | ||
180 | if (Resp.IsFault) | ||
181 | { | ||
182 | Hashtable ErrorHash = new Hashtable(); | ||
183 | ErrorHash["success"] = false; | ||
184 | ErrorHash["errorMessage"] = "Unable to fetch profile data at this time. "; | ||
185 | ErrorHash["errorURI"] = ""; | ||
186 | return ErrorHash; | ||
187 | } | ||
188 | Hashtable RespData = (Hashtable)Resp.Value; | ||
189 | |||
190 | return RespData; | ||
191 | } | ||
192 | } | 135 | } |
193 | } | 136 | } |