XmlRpcGroupsServicesConnectorModule.cs 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections;
  29. using System.Collections.Generic;
  30. using System.Reflection;
  31. using System.Text;
  32. using Nwc.XmlRpc;
  33. using log4net;
  34. using Mono.Addins;
  35. using Nini.Config;
  36. using OpenMetaverse;
  37. using OpenMetaverse.StructuredData;
  38. using OpenSim.Framework;
  39. using OpenSim.Framework.Communications;
  40. using OpenSim.Region.Framework.Interfaces;
  41. using OpenSim.Services.Interfaces;
  42. namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
  43. {
  44. [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcGroupsServicesConnectorModule")]
  45. public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector
  46. {
  47. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  48. private bool m_debugEnabled = false;
  49. public const GroupPowers DefaultEveryonePowers
  50. = GroupPowers.AllowSetHome
  51. | GroupPowers.Accountable
  52. | GroupPowers.JoinChat
  53. | GroupPowers.AllowVoiceChat
  54. | GroupPowers.ReceiveNotices
  55. | GroupPowers.StartProposal
  56. | GroupPowers.VoteOnProposal;
  57. // Would this be cleaner as (GroupPowers)ulong.MaxValue?
  58. public const GroupPowers DefaultOwnerPowers
  59. = GroupPowers.Accountable
  60. | GroupPowers.AllowEditLand
  61. | GroupPowers.AllowFly
  62. | GroupPowers.AllowLandmark
  63. | GroupPowers.AllowRez
  64. | GroupPowers.AllowSetHome
  65. | GroupPowers.AllowVoiceChat
  66. | GroupPowers.AssignMember
  67. | GroupPowers.AssignMemberLimited
  68. | GroupPowers.ChangeActions
  69. | GroupPowers.ChangeIdentity
  70. | GroupPowers.ChangeMedia
  71. | GroupPowers.ChangeOptions
  72. | GroupPowers.CreateRole
  73. | GroupPowers.DeedObject
  74. | GroupPowers.DeleteRole
  75. | GroupPowers.Eject
  76. | GroupPowers.FindPlaces
  77. | GroupPowers.Invite
  78. | GroupPowers.JoinChat
  79. | GroupPowers.LandChangeIdentity
  80. | GroupPowers.LandDeed
  81. | GroupPowers.LandDivideJoin
  82. | GroupPowers.LandEdit
  83. | GroupPowers.LandEjectAndFreeze
  84. | GroupPowers.LandGardening
  85. | GroupPowers.LandManageAllowed
  86. | GroupPowers.LandManageBanned
  87. | GroupPowers.LandManagePasses
  88. | GroupPowers.LandOptions
  89. | GroupPowers.LandRelease
  90. | GroupPowers.LandSetSale
  91. | GroupPowers.ModerateChat
  92. | GroupPowers.ObjectManipulate
  93. | GroupPowers.ObjectSetForSale
  94. | GroupPowers.ReceiveNotices
  95. | GroupPowers.RemoveMember
  96. | GroupPowers.ReturnGroupOwned
  97. | GroupPowers.ReturnGroupSet
  98. | GroupPowers.ReturnNonGroup
  99. | GroupPowers.RoleProperties
  100. | GroupPowers.SendNotices
  101. | GroupPowers.SetLandingPoint
  102. | GroupPowers.StartProposal
  103. | GroupPowers.VoteOnProposal;
  104. private bool m_connectorEnabled = false;
  105. private string m_groupsServerURI = string.Empty;
  106. private bool m_disableKeepAlive = false;
  107. private string m_groupReadKey = string.Empty;
  108. private string m_groupWriteKey = string.Empty;
  109. private IUserAccountService m_accountService = null;
  110. private ExpiringCache<string, XmlRpcResponse> m_memoryCache;
  111. private int m_cacheTimeout = 30;
  112. // Used to track which agents are have dropped from a group chat session
  113. // Should be reset per agent, on logon
  114. // TODO: move this to Flotsam XmlRpc Service
  115. // SessionID, List<AgentID>
  116. private Dictionary<UUID, List<UUID>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<UUID>>();
  117. private Dictionary<UUID, List<UUID>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<UUID>>();
  118. #region Region Module interfaceBase Members
  119. public string Name
  120. {
  121. get { return "XmlRpcGroupsServicesConnector"; }
  122. }
  123. // this module is not intended to be replaced, but there should only be 1 of them.
  124. public Type ReplaceableInterface
  125. {
  126. get { return null; }
  127. }
  128. public void Initialise(IConfigSource config)
  129. {
  130. IConfig groupsConfig = config.Configs["Groups"];
  131. if (groupsConfig == null)
  132. {
  133. // Do not run this module by default.
  134. return;
  135. }
  136. else
  137. {
  138. // if groups aren't enabled, we're not needed.
  139. // if we're not specified as the connector to use, then we're not wanted
  140. if ((groupsConfig.GetBoolean("Enabled", false) == false)
  141. || (groupsConfig.GetString("ServicesConnectorModule", "XmlRpcGroupsServicesConnector") != Name))
  142. {
  143. m_connectorEnabled = false;
  144. return;
  145. }
  146. m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Initializing {0}", this.Name);
  147. m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty);
  148. if (string.IsNullOrEmpty(m_groupsServerURI))
  149. {
  150. m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]");
  151. m_connectorEnabled = false;
  152. return;
  153. }
  154. m_disableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false);
  155. m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty);
  156. m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty);
  157. m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30);
  158. if (m_cacheTimeout == 0)
  159. {
  160. m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled.");
  161. }
  162. else
  163. {
  164. m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Timeout set to {0}.", m_cacheTimeout);
  165. }
  166. m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", false);
  167. // If we got all the config options we need, lets start'er'up
  168. m_memoryCache = new ExpiringCache<string, XmlRpcResponse>();
  169. m_connectorEnabled = true;
  170. }
  171. }
  172. public void Close()
  173. {
  174. m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Closing {0}", this.Name);
  175. }
  176. public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene)
  177. {
  178. if (m_connectorEnabled)
  179. {
  180. if (m_accountService == null)
  181. {
  182. m_accountService = scene.UserAccountService;
  183. }
  184. scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
  185. }
  186. }
  187. public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene)
  188. {
  189. if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this)
  190. {
  191. scene.UnregisterModuleInterface<IGroupsServicesConnector>(this);
  192. }
  193. }
  194. public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene)
  195. {
  196. // TODO: May want to consider listenning for Agent Connections so we can pre-cache group info
  197. // scene.EventManager.OnNewClient += OnNewClient;
  198. }
  199. #endregion
  200. #region ISharedRegionModule Members
  201. public void PostInitialise()
  202. {
  203. // NoOp
  204. }
  205. #endregion
  206. #region IGroupsServicesConnector Members
  207. /// <summary>
  208. /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role.
  209. /// </summary>
  210. public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID,
  211. int membershipFee, bool openEnrollment, bool allowPublish,
  212. bool maturePublish, UUID founderID)
  213. {
  214. UUID GroupID = UUID.Random();
  215. UUID OwnerRoleID = UUID.Random();
  216. Hashtable param = new Hashtable();
  217. param["GroupID"] = GroupID.ToString();
  218. param["Name"] = name;
  219. param["Charter"] = charter;
  220. param["ShowInList"] = showInList == true ? 1 : 0;
  221. param["InsigniaID"] = insigniaID.ToString();
  222. param["MembershipFee"] = membershipFee;
  223. param["OpenEnrollment"] = openEnrollment == true ? 1 : 0;
  224. param["AllowPublish"] = allowPublish == true ? 1 : 0;
  225. param["MaturePublish"] = maturePublish == true ? 1 : 0;
  226. param["FounderID"] = founderID.ToString();
  227. param["EveryonePowers"] = ((ulong)DefaultEveryonePowers).ToString();
  228. param["OwnerRoleID"] = OwnerRoleID.ToString();
  229. param["OwnersPowers"] = ((ulong)DefaultOwnerPowers).ToString();
  230. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param);
  231. if (respData.Contains("error"))
  232. {
  233. // UUID is not nullable
  234. return UUID.Zero;
  235. }
  236. return UUID.Parse((string)respData["GroupID"]);
  237. }
  238. public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList,
  239. UUID insigniaID, int membershipFee, bool openEnrollment,
  240. bool allowPublish, bool maturePublish)
  241. {
  242. Hashtable param = new Hashtable();
  243. param["GroupID"] = groupID.ToString();
  244. param["Charter"] = charter;
  245. param["ShowInList"] = showInList == true ? 1 : 0;
  246. param["InsigniaID"] = insigniaID.ToString();
  247. param["MembershipFee"] = membershipFee;
  248. param["OpenEnrollment"] = openEnrollment == true ? 1 : 0;
  249. param["AllowPublish"] = allowPublish == true ? 1 : 0;
  250. param["MaturePublish"] = maturePublish == true ? 1 : 0;
  251. XmlRpcCall(requestingAgentID, "groups.updateGroup", param);
  252. }
  253. public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
  254. string title, ulong powers)
  255. {
  256. Hashtable param = new Hashtable();
  257. param["GroupID"] = groupID.ToString();
  258. param["RoleID"] = roleID.ToString();
  259. param["Name"] = name;
  260. param["Description"] = description;
  261. param["Title"] = title;
  262. param["Powers"] = powers.ToString();
  263. XmlRpcCall(requestingAgentID, "groups.addRoleToGroup", param);
  264. }
  265. public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID)
  266. {
  267. Hashtable param = new Hashtable();
  268. param["GroupID"] = groupID.ToString();
  269. param["RoleID"] = roleID.ToString();
  270. XmlRpcCall(requestingAgentID, "groups.removeRoleFromGroup", param);
  271. }
  272. public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
  273. string title, ulong powers)
  274. {
  275. Hashtable param = new Hashtable();
  276. param["GroupID"] = groupID.ToString();
  277. param["RoleID"] = roleID.ToString();
  278. if (name != null)
  279. {
  280. param["Name"] = name;
  281. }
  282. if (description != null)
  283. {
  284. param["Description"] = description;
  285. }
  286. if (title != null)
  287. {
  288. param["Title"] = title;
  289. }
  290. param["Powers"] = powers.ToString();
  291. XmlRpcCall(requestingAgentID, "groups.updateGroupRole", param);
  292. }
  293. public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName)
  294. {
  295. Hashtable param = new Hashtable();
  296. if (GroupID != UUID.Zero)
  297. {
  298. param["GroupID"] = GroupID.ToString();
  299. }
  300. if (!string.IsNullOrEmpty(GroupName))
  301. {
  302. param["Name"] = GroupName.ToString();
  303. }
  304. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param);
  305. if (respData.Contains("error"))
  306. {
  307. return null;
  308. }
  309. return GroupProfileHashtableToGroupRecord(respData);
  310. }
  311. public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID)
  312. {
  313. Hashtable param = new Hashtable();
  314. param["GroupID"] = GroupID.ToString();
  315. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param);
  316. if (respData.Contains("error"))
  317. {
  318. // GroupProfileData is not nullable
  319. return new GroupProfileData();
  320. }
  321. GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID);
  322. GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData);
  323. MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle;
  324. MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
  325. return MemberGroupProfile;
  326. }
  327. public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
  328. {
  329. Hashtable param = new Hashtable();
  330. param["AgentID"] = AgentID.ToString();
  331. param["GroupID"] = GroupID.ToString();
  332. XmlRpcCall(requestingAgentID, "groups.setAgentActiveGroup", param);
  333. }
  334. public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
  335. {
  336. Hashtable param = new Hashtable();
  337. param["AgentID"] = AgentID.ToString();
  338. param["GroupID"] = GroupID.ToString();
  339. param["SelectedRoleID"] = RoleID.ToString();
  340. XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param);
  341. }
  342. public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile)
  343. {
  344. Hashtable param = new Hashtable();
  345. param["AgentID"] = AgentID.ToString();
  346. param["GroupID"] = GroupID.ToString();
  347. param["AcceptNotices"] = AcceptNotices ? "1" : "0";
  348. param["ListInProfile"] = ListInProfile ? "1" : "0";
  349. XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param);
  350. }
  351. public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID)
  352. {
  353. Hashtable param = new Hashtable();
  354. param["InviteID"] = inviteID.ToString();
  355. param["AgentID"] = agentID.ToString();
  356. param["RoleID"] = roleID.ToString();
  357. param["GroupID"] = groupID.ToString();
  358. XmlRpcCall(requestingAgentID, "groups.addAgentToGroupInvite", param);
  359. }
  360. public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
  361. {
  362. Hashtable param = new Hashtable();
  363. param["InviteID"] = inviteID.ToString();
  364. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentToGroupInvite", param);
  365. if (respData.Contains("error"))
  366. {
  367. return null;
  368. }
  369. GroupInviteInfo inviteInfo = new GroupInviteInfo();
  370. inviteInfo.InviteID = inviteID;
  371. inviteInfo.GroupID = UUID.Parse((string)respData["GroupID"]);
  372. inviteInfo.RoleID = UUID.Parse((string)respData["RoleID"]);
  373. inviteInfo.AgentID = UUID.Parse((string)respData["AgentID"]);
  374. return inviteInfo;
  375. }
  376. public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
  377. {
  378. Hashtable param = new Hashtable();
  379. param["InviteID"] = inviteID.ToString();
  380. XmlRpcCall(requestingAgentID, "groups.removeAgentToGroupInvite", param);
  381. }
  382. public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
  383. {
  384. Hashtable param = new Hashtable();
  385. param["AgentID"] = AgentID.ToString();
  386. param["GroupID"] = GroupID.ToString();
  387. param["RoleID"] = RoleID.ToString();
  388. XmlRpcCall(requestingAgentID, "groups.addAgentToGroup", param);
  389. }
  390. public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
  391. {
  392. Hashtable param = new Hashtable();
  393. param["AgentID"] = AgentID.ToString();
  394. param["GroupID"] = GroupID.ToString();
  395. XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroup", param);
  396. }
  397. public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
  398. {
  399. Hashtable param = new Hashtable();
  400. param["AgentID"] = AgentID.ToString();
  401. param["GroupID"] = GroupID.ToString();
  402. param["RoleID"] = RoleID.ToString();
  403. XmlRpcCall(requestingAgentID, "groups.addAgentToGroupRole", param);
  404. }
  405. public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
  406. {
  407. Hashtable param = new Hashtable();
  408. param["AgentID"] = AgentID.ToString();
  409. param["GroupID"] = GroupID.ToString();
  410. param["RoleID"] = RoleID.ToString();
  411. XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroupRole", param);
  412. }
  413. public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search)
  414. {
  415. Hashtable param = new Hashtable();
  416. param["Search"] = search;
  417. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.findGroups", param);
  418. List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>();
  419. if (!respData.Contains("error"))
  420. {
  421. Hashtable results = (Hashtable)respData["results"];
  422. foreach (Hashtable groupFind in results.Values)
  423. {
  424. DirGroupsReplyData data = new DirGroupsReplyData();
  425. data.groupID = new UUID((string)groupFind["GroupID"]); ;
  426. data.groupName = (string)groupFind["Name"];
  427. data.members = int.Parse((string)groupFind["Members"]);
  428. // data.searchOrder = order;
  429. findings.Add(data);
  430. }
  431. }
  432. return findings;
  433. }
  434. public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID)
  435. {
  436. Hashtable param = new Hashtable();
  437. param["AgentID"] = AgentID.ToString();
  438. param["GroupID"] = GroupID.ToString();
  439. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMembership", param);
  440. if (respData.Contains("error"))
  441. {
  442. return null;
  443. }
  444. GroupMembershipData data = HashTableToGroupMembershipData(respData);
  445. return data;
  446. }
  447. public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID)
  448. {
  449. Hashtable param = new Hashtable();
  450. param["AgentID"] = AgentID.ToString();
  451. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentActiveMembership", param);
  452. if (respData.Contains("error"))
  453. {
  454. return null;
  455. }
  456. return HashTableToGroupMembershipData(respData);
  457. }
  458. public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID)
  459. {
  460. Hashtable param = new Hashtable();
  461. param["AgentID"] = AgentID.ToString();
  462. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMemberships", param);
  463. List<GroupMembershipData> memberships = new List<GroupMembershipData>();
  464. if (!respData.Contains("error"))
  465. {
  466. foreach (object membership in respData.Values)
  467. {
  468. memberships.Add(HashTableToGroupMembershipData((Hashtable)membership));
  469. }
  470. }
  471. return memberships;
  472. }
  473. public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID)
  474. {
  475. Hashtable param = new Hashtable();
  476. param["AgentID"] = AgentID.ToString();
  477. param["GroupID"] = GroupID.ToString();
  478. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentRoles", param);
  479. List<GroupRolesData> Roles = new List<GroupRolesData>();
  480. if (respData.Contains("error"))
  481. {
  482. return Roles;
  483. }
  484. foreach (Hashtable role in respData.Values)
  485. {
  486. GroupRolesData data = new GroupRolesData();
  487. data.RoleID = new UUID((string)role["RoleID"]);
  488. data.Name = (string)role["Name"];
  489. data.Description = (string)role["Description"];
  490. data.Powers = ulong.Parse((string)role["Powers"]);
  491. data.Title = (string)role["Title"];
  492. Roles.Add(data);
  493. }
  494. return Roles;
  495. }
  496. public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID)
  497. {
  498. Hashtable param = new Hashtable();
  499. param["GroupID"] = GroupID.ToString();
  500. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoles", param);
  501. List<GroupRolesData> Roles = new List<GroupRolesData>();
  502. if (respData.Contains("error"))
  503. {
  504. return Roles;
  505. }
  506. foreach (Hashtable role in respData.Values)
  507. {
  508. GroupRolesData data = new GroupRolesData();
  509. data.Description = (string)role["Description"];
  510. data.Members = int.Parse((string)role["Members"]);
  511. data.Name = (string)role["Name"];
  512. data.Powers = ulong.Parse((string)role["Powers"]);
  513. data.RoleID = new UUID((string)role["RoleID"]);
  514. data.Title = (string)role["Title"];
  515. Roles.Add(data);
  516. }
  517. return Roles;
  518. }
  519. public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID)
  520. {
  521. Hashtable param = new Hashtable();
  522. param["GroupID"] = GroupID.ToString();
  523. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param);
  524. List<GroupMembersData> members = new List<GroupMembersData>();
  525. if (respData.Contains("error"))
  526. {
  527. return members;
  528. }
  529. foreach (Hashtable membership in respData.Values)
  530. {
  531. GroupMembersData data = new GroupMembersData();
  532. data.AcceptNotices = ((string)membership["AcceptNotices"]) == "1";
  533. data.AgentID = new UUID((string)membership["AgentID"]);
  534. data.Contribution = int.Parse((string)membership["Contribution"]);
  535. data.IsOwner = ((string)membership["IsOwner"]) == "1";
  536. data.ListInProfile = ((string)membership["ListInProfile"]) == "1";
  537. data.AgentPowers = ulong.Parse((string)membership["AgentPowers"]);
  538. data.Title = (string)membership["Title"];
  539. members.Add(data);
  540. }
  541. return members;
  542. }
  543. public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
  544. {
  545. Hashtable param = new Hashtable();
  546. param["GroupID"] = GroupID.ToString();
  547. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoleMembers", param);
  548. List<GroupRoleMembersData> members = new List<GroupRoleMembersData>();
  549. if (!respData.Contains("error"))
  550. {
  551. foreach (Hashtable membership in respData.Values)
  552. {
  553. GroupRoleMembersData data = new GroupRoleMembersData();
  554. data.MemberID = new UUID((string)membership["AgentID"]);
  555. data.RoleID = new UUID((string)membership["RoleID"]);
  556. members.Add(data);
  557. }
  558. }
  559. return members;
  560. }
  561. public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID)
  562. {
  563. Hashtable param = new Hashtable();
  564. param["GroupID"] = GroupID.ToString();
  565. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotices", param);
  566. List<GroupNoticeData> values = new List<GroupNoticeData>();
  567. if (!respData.Contains("error"))
  568. {
  569. foreach (Hashtable value in respData.Values)
  570. {
  571. GroupNoticeData data = new GroupNoticeData();
  572. data.NoticeID = UUID.Parse((string)value["NoticeID"]);
  573. data.Timestamp = uint.Parse((string)value["Timestamp"]);
  574. data.FromName = (string)value["FromName"];
  575. data.Subject = (string)value["Subject"];
  576. data.HasAttachment = false;
  577. data.AssetType = 0;
  578. values.Add(data);
  579. }
  580. }
  581. return values;
  582. }
  583. public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)
  584. {
  585. Hashtable param = new Hashtable();
  586. param["NoticeID"] = noticeID.ToString();
  587. Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param);
  588. if (respData.Contains("error"))
  589. {
  590. return null;
  591. }
  592. GroupNoticeInfo data = new GroupNoticeInfo();
  593. data.GroupID = UUID.Parse((string)respData["GroupID"]);
  594. data.Message = (string)respData["Message"];
  595. data.BinaryBucket = Utils.HexStringToBytes((string)respData["BinaryBucket"], true);
  596. data.noticeData.NoticeID = UUID.Parse((string)respData["NoticeID"]);
  597. data.noticeData.Timestamp = uint.Parse((string)respData["Timestamp"]);
  598. data.noticeData.FromName = (string)respData["FromName"];
  599. data.noticeData.Subject = (string)respData["Subject"];
  600. data.noticeData.HasAttachment = false;
  601. data.noticeData.AssetType = 0;
  602. if (data.Message == null)
  603. {
  604. data.Message = string.Empty;
  605. }
  606. return data;
  607. }
  608. public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
  609. {
  610. string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, "");
  611. Hashtable param = new Hashtable();
  612. param["GroupID"] = groupID.ToString();
  613. param["NoticeID"] = noticeID.ToString();
  614. param["FromName"] = fromName;
  615. param["Subject"] = subject;
  616. param["Message"] = message;
  617. param["BinaryBucket"] = binBucket;
  618. param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString();
  619. XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param);
  620. }
  621. #endregion
  622. #region GroupSessionTracking
  623. public void ResetAgentGroupChatSessions(UUID agentID)
  624. {
  625. foreach (List<UUID> agentList in m_groupsAgentsDroppedFromChatSession.Values)
  626. {
  627. agentList.Remove(agentID);
  628. }
  629. }
  630. public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID)
  631. {
  632. // If we're tracking this group, and we can find them in the tracking, then they've been invited
  633. return m_groupsAgentsInvitedToChatSession.ContainsKey(groupID)
  634. && m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID);
  635. }
  636. public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID)
  637. {
  638. // If we're tracking drops for this group,
  639. // and we find them, well... then they've dropped
  640. return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)
  641. && m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID);
  642. }
  643. public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID)
  644. {
  645. if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
  646. {
  647. // If not in dropped list, add
  648. if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
  649. {
  650. m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID);
  651. }
  652. }
  653. }
  654. public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID)
  655. {
  656. // Add Session Status if it doesn't exist for this session
  657. CreateGroupChatSessionTracking(groupID);
  658. // If nessesary, remove from dropped list
  659. if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID))
  660. {
  661. m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID);
  662. }
  663. }
  664. private void CreateGroupChatSessionTracking(UUID groupID)
  665. {
  666. if (!m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID))
  667. {
  668. m_groupsAgentsDroppedFromChatSession.Add(groupID, new List<UUID>());
  669. m_groupsAgentsInvitedToChatSession.Add(groupID, new List<UUID>());
  670. }
  671. }
  672. #endregion
  673. #region XmlRpcHashtableMarshalling
  674. private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile)
  675. {
  676. GroupProfileData group = new GroupProfileData();
  677. group.GroupID = UUID.Parse((string)groupProfile["GroupID"]);
  678. group.Name = (string)groupProfile["Name"];
  679. if (groupProfile["Charter"] != null)
  680. {
  681. group.Charter = (string)groupProfile["Charter"];
  682. }
  683. group.ShowInList = ((string)groupProfile["ShowInList"]) == "1";
  684. group.InsigniaID = UUID.Parse((string)groupProfile["InsigniaID"]);
  685. group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]);
  686. group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1";
  687. group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1";
  688. group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1";
  689. group.FounderID = UUID.Parse((string)groupProfile["FounderID"]);
  690. group.OwnerRole = UUID.Parse((string)groupProfile["OwnerRoleID"]);
  691. group.GroupMembershipCount = int.Parse((string)groupProfile["GroupMembershipCount"]);
  692. group.GroupRolesCount = int.Parse((string)groupProfile["GroupRolesCount"]);
  693. return group;
  694. }
  695. private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile)
  696. {
  697. GroupRecord group = new GroupRecord();
  698. group.GroupID = UUID.Parse((string)groupProfile["GroupID"]);
  699. group.GroupName = groupProfile["Name"].ToString();
  700. if (groupProfile["Charter"] != null)
  701. {
  702. group.Charter = (string)groupProfile["Charter"];
  703. }
  704. group.ShowInList = ((string)groupProfile["ShowInList"]) == "1";
  705. group.GroupPicture = UUID.Parse((string)groupProfile["InsigniaID"]);
  706. group.MembershipFee = int.Parse((string)groupProfile["MembershipFee"]);
  707. group.OpenEnrollment = ((string)groupProfile["OpenEnrollment"]) == "1";
  708. group.AllowPublish = ((string)groupProfile["AllowPublish"]) == "1";
  709. group.MaturePublish = ((string)groupProfile["MaturePublish"]) == "1";
  710. group.FounderID = UUID.Parse((string)groupProfile["FounderID"]);
  711. group.OwnerRoleID = UUID.Parse((string)groupProfile["OwnerRoleID"]);
  712. return group;
  713. }
  714. private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData)
  715. {
  716. GroupMembershipData data = new GroupMembershipData();
  717. data.AcceptNotices = ((string)respData["AcceptNotices"] == "1");
  718. data.Contribution = int.Parse((string)respData["Contribution"]);
  719. data.ListInProfile = ((string)respData["ListInProfile"] == "1");
  720. data.ActiveRole = new UUID((string)respData["SelectedRoleID"]);
  721. data.GroupTitle = (string)respData["Title"];
  722. data.GroupPowers = ulong.Parse((string)respData["GroupPowers"]);
  723. // Is this group the agent's active group
  724. data.GroupID = new UUID((string)respData["GroupID"]);
  725. UUID ActiveGroup = new UUID((string)respData["ActiveGroupID"]);
  726. data.Active = data.GroupID.Equals(ActiveGroup);
  727. data.AllowPublish = ((string)respData["AllowPublish"] == "1");
  728. if (respData["Charter"] != null)
  729. {
  730. data.Charter = (string)respData["Charter"];
  731. }
  732. data.FounderID = new UUID((string)respData["FounderID"]);
  733. data.GroupID = new UUID((string)respData["GroupID"]);
  734. data.GroupName = (string)respData["GroupName"];
  735. data.GroupPicture = new UUID((string)respData["InsigniaID"]);
  736. data.MaturePublish = ((string)respData["MaturePublish"] == "1");
  737. data.MembershipFee = int.Parse((string)respData["MembershipFee"]);
  738. data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1");
  739. data.ShowInList = ((string)respData["ShowInList"] == "1");
  740. return data;
  741. }
  742. #endregion
  743. /// <summary>
  744. /// Encapsulate the XmlRpc call to standardize security and error handling.
  745. /// </summary>
  746. private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param)
  747. {
  748. XmlRpcResponse resp = null;
  749. string CacheKey = null;
  750. // Only bother with the cache if it isn't disabled.
  751. if (m_cacheTimeout > 0)
  752. {
  753. if (!function.StartsWith("groups.get"))
  754. {
  755. // Any and all updates cause the cache to clear
  756. m_memoryCache.Clear();
  757. }
  758. else
  759. {
  760. StringBuilder sb = new StringBuilder(requestingAgentID + function);
  761. foreach (object key in param.Keys)
  762. {
  763. if (param[key] != null)
  764. {
  765. sb.AppendFormat(",{0}:{1}", key.ToString(), param[key].ToString());
  766. }
  767. }
  768. CacheKey = sb.ToString();
  769. m_memoryCache.TryGetValue(CacheKey, out resp);
  770. }
  771. }
  772. if (resp == null)
  773. {
  774. if (m_debugEnabled)
  775. m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Cache miss for key {0}", CacheKey);
  776. string UserService;
  777. UUID SessionID;
  778. GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
  779. param.Add("RequestingAgentID", requestingAgentID.ToString());
  780. param.Add("RequestingAgentUserService", UserService);
  781. param.Add("RequestingSessionID", SessionID.ToString());
  782. param.Add("ReadKey", m_groupReadKey);
  783. param.Add("WriteKey", m_groupWriteKey);
  784. IList parameters = new ArrayList();
  785. parameters.Add(param);
  786. ConfigurableKeepAliveXmlRpcRequest req;
  787. req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
  788. try
  789. {
  790. resp = req.Send(m_groupsServerURI, 10000);
  791. if ((m_cacheTimeout > 0) && (CacheKey != null))
  792. {
  793. m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
  794. }
  795. }
  796. catch (Exception e)
  797. {
  798. m_log.ErrorFormat(
  799. "[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method {0} at {1}",
  800. function, m_groupsServerURI);
  801. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}{1}", e.Message, e.StackTrace);
  802. foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
  803. {
  804. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", ResponseLine);
  805. }
  806. foreach (string key in param.Keys)
  807. {
  808. m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", key, param[key].ToString());
  809. }
  810. Hashtable respData = new Hashtable();
  811. respData.Add("error", e.ToString());
  812. return respData;
  813. }
  814. }
  815. if (resp.Value is Hashtable)
  816. {
  817. Hashtable respData = (Hashtable)resp.Value;
  818. if (respData.Contains("error") && !respData.Contains("succeed"))
  819. {
  820. LogRespDataToConsoleError(requestingAgentID, function, param, respData);
  821. }
  822. return respData;
  823. }
  824. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString());
  825. if (resp.Value is ArrayList)
  826. {
  827. ArrayList al = (ArrayList)resp.Value;
  828. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Contains {0} elements", al.Count);
  829. foreach (object o in al)
  830. {
  831. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", o.GetType().ToString(), o.ToString());
  832. }
  833. }
  834. else
  835. {
  836. m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Function returned: {0}", resp.Value.ToString());
  837. }
  838. Hashtable error = new Hashtable();
  839. error.Add("error", "invalid return value");
  840. return error;
  841. }
  842. private void LogRespDataToConsoleError(UUID requestingAgentID, string function, Hashtable param, Hashtable respData)
  843. {
  844. m_log.ErrorFormat(
  845. "[XMLRPC-GROUPS-CONNECTOR]: Error when calling {0} for {1} with params {2}. Response params are {3}",
  846. function, requestingAgentID, Util.PrettyFormatToSingleLine(param), Util.PrettyFormatToSingleLine(respData));
  847. }
  848. /// <summary>
  849. /// Group Request Tokens are an attempt to allow the groups service to authenticate
  850. /// requests.
  851. /// TODO: This broke after the big grid refactor, either find a better way, or discard this
  852. /// </summary>
  853. /// <param name="client"></param>
  854. /// <returns></returns>
  855. private void GetClientGroupRequestID(UUID AgentID, out string UserServiceURL, out UUID SessionID)
  856. {
  857. UserServiceURL = "";
  858. SessionID = UUID.Zero;
  859. // Need to rework this based on changes to User Services
  860. /*
  861. UserAccount userAccount = m_accountService.GetUserAccount(UUID.Zero,AgentID);
  862. if (userAccount == null)
  863. {
  864. // This should be impossible. If I've been passed a reference to a client
  865. // that client should be registered with the UserService. So something
  866. // is horribly wrong somewhere.
  867. m_log.WarnFormat("[GROUPS]: Could not find a UserServiceURL for {0}", AgentID);
  868. }
  869. else if (userProfile is ForeignUserProfileData)
  870. {
  871. // They aren't from around here
  872. ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile;
  873. UserServiceURL = fupd.UserServerURI;
  874. SessionID = fupd.CurrentAgent.SessionID;
  875. }
  876. else
  877. {
  878. // They're a local user, use this:
  879. UserServiceURL = m_commManager.NetworkServersInfo.UserURL;
  880. SessionID = userProfile.CurrentAgent.SessionID;
  881. }
  882. */
  883. }
  884. }
  885. }
  886. namespace Nwc.XmlRpc
  887. {
  888. using System;
  889. using System.Collections;
  890. using System.IO;
  891. using System.Xml;
  892. using System.Net;
  893. using System.Text;
  894. using System.Reflection;
  895. /// <summary>Class supporting the request side of an XML-RPC transaction.</summary>
  896. public class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest
  897. {
  898. private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer();
  899. private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer();
  900. private bool _disableKeepAlive = true;
  901. public string RequestResponse = String.Empty;
  902. /// <summary>Instantiate an <c>XmlRpcRequest</c> for a specified method and parameters.</summary>
  903. /// <param name="methodName"><c>String</c> designating the <i>object.method</i> on the server the request
  904. /// should be directed to.</param>
  905. /// <param name="parameters"><c>ArrayList</c> of XML-RPC type parameters to invoke the request with.</param>
  906. public ConfigurableKeepAliveXmlRpcRequest(String methodName, IList parameters, bool disableKeepAlive)
  907. {
  908. MethodName = methodName;
  909. _params = parameters;
  910. _disableKeepAlive = disableKeepAlive;
  911. }
  912. /// <summary>Send the request to the server.</summary>
  913. /// <param name="url"><c>String</c> The url of the XML-RPC server.</param>
  914. /// <returns><c>XmlRpcResponse</c> The response generated.</returns>
  915. public XmlRpcResponse Send(String url)
  916. {
  917. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
  918. if (request == null)
  919. throw new XmlRpcException(XmlRpcErrorCodes.TRANSPORT_ERROR,
  920. XmlRpcErrorCodes.TRANSPORT_ERROR_MSG + ": Could not create request with " + url);
  921. request.Method = "POST";
  922. request.ContentType = "text/xml";
  923. request.AllowWriteStreamBuffering = true;
  924. request.KeepAlive = !_disableKeepAlive;
  925. using (Stream stream = request.GetRequestStream())
  926. {
  927. using (XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII))
  928. {
  929. _serializer.Serialize(xml, this);
  930. xml.Flush();
  931. }
  932. }
  933. XmlRpcResponse resp;
  934. using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
  935. {
  936. using (Stream s = response.GetResponseStream())
  937. {
  938. using (StreamReader input = new StreamReader(s))
  939. {
  940. string inputXml = input.ReadToEnd();
  941. try
  942. {
  943. resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml);
  944. }
  945. catch (Exception e)
  946. {
  947. RequestResponse = inputXml;
  948. throw e;
  949. }
  950. }
  951. }
  952. }
  953. return resp;
  954. }
  955. }
  956. }