当前位置: 首页>>代码示例>>C#>>正文


C# XmlRpc.XmlRpcRequest类代码示例

本文整理汇总了C#中Nwc.XmlRpc.XmlRpcRequest的典型用法代码示例。如果您正苦于以下问题:C# XmlRpcRequest类的具体用法?C# XmlRpcRequest怎么用?C# XmlRpcRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XmlRpcRequest类属于Nwc.XmlRpc命名空间,在下文中一共展示了XmlRpcRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RequestSimData

        /// <summary>
        /// Request sim data based on arbitrary key/value
        /// </summary>
        private RegionProfileData RequestSimData(Uri gridserverUrl, string gridserverSendkey, string keyField, string keyValue)
        {
            Hashtable requestData = new Hashtable();
            requestData[keyField] = keyValue;
            requestData["authkey"] = gridserverSendkey;
            ArrayList SendParams = new ArrayList();
            SendParams.Add(requestData);
            XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
            XmlRpcResponse GridResp = GridReq.Send(gridserverUrl.ToString(), 3000);

            Hashtable responseData = (Hashtable) GridResp.Value;

            RegionProfileData simData = null;

            if (!responseData.ContainsKey("error"))
            {
                uint locX = Convert.ToUInt32((string)responseData["region_locx"]);
                uint locY = Convert.ToUInt32((string)responseData["region_locy"]);
                string externalHostName = (string)responseData["sim_ip"];
                uint simPort = Convert.ToUInt32((string)responseData["sim_port"]);
                uint httpPort = Convert.ToUInt32((string)responseData["http_port"]);
                uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
                string serverUri = (string)responseData["server_uri"];
                UUID regionID = new UUID((string)responseData["region_UUID"]);
                string regionName = (string)responseData["region_name"];
                byte access = Convert.ToByte((string)responseData["access"]);

                simData = RegionProfileData.Create(regionID, regionName, locX, locY, externalHostName, simPort, httpPort, remotingPort, serverUri, access);
            }

            return simData;
        }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:35,代码来源:RegionProfileServiceProxy.cs

示例2: Connect

 public bool Connect(string GridServerURL, string username, string password)
 {
     try
     {
         this.ServerURL=GridServerURL;
         Hashtable LoginParamsHT = new Hashtable();
         LoginParamsHT["username"]=username;
         LoginParamsHT["password"]=password;
         ArrayList LoginParams = new ArrayList();
         LoginParams.Add(LoginParamsHT);
         XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams);
         XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000);
         if (GridResp.IsFault)
         {
             connected=false;
             return false;
         }
         else
         {
             Hashtable gridrespData = (Hashtable)GridResp.Value;
             this.SessionID = new LLUUID((string)gridrespData["session_id"]);
             connected=true;
             return true;
         }
     }
     catch(Exception e)
     {
         Console.WriteLine(e.ToString());
         connected=false;
         return false;
     }
 }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:32,代码来源:GridServerConnectionManager.cs

示例3: GetLandData

        public virtual LandData GetLandData(ulong regionHandle, uint x, uint y)
        {
            LandData landData = null;
            Hashtable hash = new Hashtable();
            hash["region_handle"] = regionHandle.ToString();
            hash["x"] = x.ToString();
            hash["y"] = y.ToString();

            IList paramList = new ArrayList();
            paramList.Add(hash);

            try
            {
                uint xpos = 0, ypos = 0;
                Utils.LongToUInts(regionHandle, out xpos, out ypos);
                GridRegion info = m_GridService.GetRegionByPosition(UUID.Zero, (int)xpos, (int)ypos);
                if (info != null) // just to be sure
                {
                    XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
                    string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
                    XmlRpcResponse response = request.Send(uri, 10000);
                    if (response.IsFault)
                    {
                        m_log.ErrorFormat("[LAND CONNECTOR] remote call returned an error: {0}", response.FaultString);
                    }
                    else
                    {
                        hash = (Hashtable)response.Value;
                        try
                        {
                            landData = new LandData();
                            landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]);
                            landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]);
                            landData.Area = Convert.ToInt32(hash["Area"]);
                            landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]);
                            landData.Description = (string)hash["Description"];
                            landData.Flags = Convert.ToUInt32(hash["Flags"]);
                            landData.GlobalID = new UUID((string)hash["GlobalID"]);
                            landData.Name = (string)hash["Name"];
                            landData.OwnerID = new UUID((string)hash["OwnerID"]);
                            landData.SalePrice = Convert.ToInt32(hash["SalePrice"]);
                            landData.SnapshotID = new UUID((string)hash["SnapshotID"]);
                            landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]);
                            m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name);
                        }
                        catch (Exception e)
                        {
                            m_log.Error("[LAND CONNECTOR] Got exception while parsing land-data:", e);
                        }
                    }
                }
                else m_log.WarnFormat("[LAND CONNECTOR] Couldn't find region with handle {0}", regionHandle);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[LAND CONNECTOR] Couldn't contact region {0}: {1}", regionHandle, e);
            }
        
            return landData;
        }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:60,代码来源:LandServiceConnector.cs

示例4: LinkRegionRequest

        /// <summary>
        /// Someone wants to link to us
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            Hashtable requestData = (Hashtable)request.Params[0];
            //string host = (string)requestData["host"];
            //string portstr = (string)requestData["port"];
            string name = (string)requestData["region_name"];
            if (name == null)
                name = string.Empty;

            UUID regionID = UUID.Zero;
            string externalName = string.Empty;
            string imageURL = string.Empty;
            ulong regionHandle = 0;
            string reason = string.Empty;

            bool success = m_GatekeeperService.LinkRegion(name, out regionID, out regionHandle, out externalName, out imageURL, out reason);

            Hashtable hash = new Hashtable();
            hash["result"] = success.ToString();
            hash["uuid"] = regionID.ToString();
            hash["handle"] = regionHandle.ToString();
            hash["region_image"] = imageURL;
            hash["external_name"] = externalName;

            XmlRpcResponse response = new XmlRpcResponse();
            response.Value = hash;
            return response;
        }
开发者ID:SignpostMarv,项目名称:opensim,代码行数:33,代码来源:HypergridHandlers.cs

示例5: GetLandData

        public XmlRpcResponse GetLandData(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            Hashtable requestData = (Hashtable)request.Params[0];
            ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]);
            uint x = Convert.ToUInt32(requestData["x"]);
            uint y = Convert.ToUInt32(requestData["y"]);
            m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle);

            byte regionAccess;
            LandData landData = m_LocalService.GetLandData(regionHandle, x, y, out regionAccess);
            Hashtable hash = new Hashtable();
            if (landData != null)
            {
                // for now, only push out the data we need for answering a ParcelInfoReqeust
                hash["AABBMax"] = landData.AABBMax.ToString();
                hash["AABBMin"] = landData.AABBMin.ToString();
                hash["Area"] = landData.Area.ToString();
                hash["AuctionID"] = landData.AuctionID.ToString();
                hash["Description"] = landData.Description;
                hash["Flags"] = landData.Flags.ToString();
                hash["GlobalID"] = landData.GlobalID.ToString();
                hash["Name"] = landData.Name;
                hash["OwnerID"] = landData.OwnerID.ToString();
                hash["SalePrice"] = landData.SalePrice.ToString();
                hash["SnapshotID"] = landData.SnapshotID.ToString();
                hash["UserLocation"] = landData.UserLocation.ToString();
                hash["RegionAccess"] = regionAccess.ToString();
            }

            XmlRpcResponse response = new XmlRpcResponse();
            response.Value = hash;
            return response;
        }
开发者ID:N3X15,项目名称:VoxelSim,代码行数:33,代码来源:LandHandlers.cs

示例6: Deserialize

        /// <summary>Static method that parses XML data into a request using the Singleton.</summary>
        /// <param name="xmlData"><c>StreamReader</c> containing an XML-RPC request.</param>
        /// <returns><c>XmlRpcRequest</c> object resulting from the parse.</returns>
        override public Object Deserialize(TextReader xmlData)
        {
            XmlTextReader reader = new XmlTextReader(xmlData);
            XmlRpcRequest request = new XmlRpcRequest();
            bool done = false;

            lock (this)
            {
                Reset();
                while (!done && reader.Read())
                {
                    DeserializeNode(reader); // Parent parse...
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.EndElement:
                            switch (reader.Name)
                            {
                                case METHOD_NAME:
                                    request.MethodName = _text;
                                    break;
                                case METHOD_CALL:
                                    done = true;
                                    break;
                                case PARAM:
                                    request.Params.Add(_value);
                                    _text = null;
                                    break;
                            }
                            break;
                    }
                }
            }
            return request;
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:37,代码来源:XmlRpcRequestDeserializer.cs

示例7: LoadFromGrid

        public SimProfile LoadFromGrid(LLUUID UUID, string GridURL, string SendKey, string RecvKey)
        {
            try
            {
                Hashtable GridReqParams = new Hashtable();
                GridReqParams["UUID"] = UUID.ToString();
                GridReqParams["authkey"] = SendKey;
                ArrayList SendParams = new ArrayList();
                SendParams.Add(GridReqParams);
                XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);

                XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);

                Hashtable RespData = (Hashtable)GridResp.Value;
                this.UUID = new LLUUID((string)RespData["UUID"]);
                this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
                this.regionname = (string)RespData["regionname"];
                this.sim_ip = (string)RespData["sim_ip"];
                this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
                this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/";
                this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]);
                this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]);
                this.sendkey = SendKey;
                this.recvkey = RecvKey;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            return this;
        }
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:31,代码来源:SimProfile.cs

示例8: GetRegion

        public XmlRpcResponse GetRegion(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            Hashtable requestData = (Hashtable)request.Params[0];
            //string host = (string)requestData["host"];
            //string portstr = (string)requestData["port"];
            string regionID_str = (string)requestData["region_uuid"];
            UUID regionID = UUID.Zero;
            UUID.TryParse(regionID_str, out regionID);

            GridRegion regInfo = m_GatekeeperService.GetHyperlinkRegion(regionID);

            Hashtable hash = new Hashtable();
            if (regInfo == null)
                hash["result"] = "false";
            else
            {
                hash["result"] = "true";
                hash["uuid"] = regInfo.RegionID.ToString();
                hash["x"] = regInfo.RegionLocX.ToString();
                hash["y"] = regInfo.RegionLocY.ToString();
                hash["region_name"] = regInfo.RegionName;
                hash["hostname"] = regInfo.ExternalHostName;
                hash["http_port"] = regInfo.HttpPort.ToString();
                hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
            }
            XmlRpcResponse response = new XmlRpcResponse();
            response.Value = hash;
            return response;

        }
开发者ID:dreamerc,项目名称:diva-distribution,代码行数:30,代码来源:HypergridHandlers.cs

示例9: Parse

    public static XmlRpcRequest Parse(StreamReader xmlData)
      {
	XmlTextReader reader = new XmlTextReader(xmlData);
	XmlRpcRequest request = new XmlRpcRequest();
	bool done = false;


	while (!done && reader.Read())
	  {
	    Singleton.ParseNode(reader); // Parent parse...
            switch (reader.NodeType)
	      {
	      case XmlNodeType.EndElement:
		switch (reader.Name)
		  {
		  case METHOD_NAME:
		    request.MethodName = Singleton._text;
		    break;
		  case METHOD_CALL:
		    done = true;
		    break;
		  case PARAM:
		    request.Params.Add(Singleton._value);
		    Singleton._text = null;
		    break;
		  }
		break;
	      default:
		Singleton.ParseNode(reader);
		break;
	      }	
	  }
	return request;
      }
开发者ID:heran,项目名称:DekiWiki,代码行数:34,代码来源:XmlRpcRequestDeserializer.cs

示例10: GetHomeRegion

        public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            Hashtable requestData = (Hashtable)request.Params[0];
            //string host = (string)requestData["host"];
            //string portstr = (string)requestData["port"];
            string userID_str = (string)requestData["userID"];
            UUID userID = UUID.Zero;
            UUID.TryParse(userID_str, out userID);

            Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY;
            GridRegion regInfo = m_HomeUsersService.GetHomeRegion(userID, out position, out lookAt);

            Hashtable hash = new Hashtable();
            if (regInfo == null)
                hash["result"] = "false";
            else
            {
                hash["result"] = "true";
                hash["uuid"] = regInfo.RegionID.ToString();
                hash["x"] = regInfo.RegionLocX.ToString();
                hash["y"] = regInfo.RegionLocY.ToString();
                hash["region_name"] = regInfo.RegionName;
                hash["hostname"] = regInfo.ExternalHostName;
                hash["http_port"] = regInfo.HttpPort.ToString();
                hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
                hash["position"] = position.ToString();
                hash["lookAt"] = lookAt.ToString();
            }
            XmlRpcResponse response = new XmlRpcResponse();
            response.Value = hash;
            return response;

        }
开发者ID:AlexRa,项目名称:opensim-mods-Alex,代码行数:33,代码来源:UserAgentServerConnector.cs

示例11: GenerateKeyMethod

        public XmlRpcResponse GenerateKeyMethod(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            XmlRpcResponse response = new XmlRpcResponse();

            if (request.Params.Count < 2)
            {
                response.IsFault = true;
                response.SetFault(-1, "Invalid parameters");
                return response;
            }

            // Verify the key of who's calling
            UUID userID = UUID.Zero;
            string authKey = string.Empty;
            UUID.TryParse((string)request.Params[0], out userID);
            authKey = (string)request.Params[1];

            m_log.InfoFormat("[AUTH HANDLER] GenerateKey called with authToken {0}", authKey);
            string newKey = string.Empty;

            newKey = m_LocalService.GetKey(userID, authKey.ToString());
 
            response.Value = (string)newKey;
            return response;
        }
开发者ID:ChrisD,项目名称:opensim,代码行数:25,代码来源:HGAuthenticationHandlers.cs

示例12: CustomiseResponse

        public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser)
        {
            //default method set up to act as ogs user server
            SimProfile SimInfo= new SimProfile();
            //get siminfo from grid server
            SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
            Int32 circode = (Int32)Convert.ToUInt32(response["circuit_code"]);
            theUser.AddSimCircuit((uint)circode, SimInfo.UUID);
            response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
            response["sim_ip"] = SimInfo.sim_ip;
            response["sim_port"] = (Int32)SimInfo.sim_port;
            response["region_y"] = (Int32)SimInfo.RegionLocY * 256;
            response["region_x"] = (Int32)SimInfo.RegionLocX * 256;

            //default is ogs user server, so let the sim know about the user via a XmlRpcRequest
            Console.WriteLine(SimInfo.caps_url);
            Hashtable SimParams = new Hashtable();
            SimParams["session_id"] = theUser.CurrentSessionID.ToString();
            SimParams["secure_session_id"] = theUser.CurrentSecureSessionID.ToString();
            SimParams["firstname"] = theUser.firstname;
            SimParams["lastname"] = theUser.lastname;
            SimParams["agent_id"] = theUser.UUID.ToString();
            SimParams["circuit_code"] = (Int32)circode;
            SimParams["startpos_x"] = theUser.homepos.X.ToString();
            SimParams["startpos_y"] = theUser.homepos.Y.ToString();
            SimParams["startpos_z"] = theUser.homepos.Z.ToString();
            ArrayList SendParams = new ArrayList();
            SendParams.Add(SimParams);

            XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
            XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000);
        }
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:32,代码来源:UserProfileManager.cs

示例13: XmlRPCGetAvatarAppearance

        public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            XmlRpcResponse response = new XmlRpcResponse();
            Hashtable requestData = (Hashtable)request.Params[0];
            AvatarAppearance appearance;
            Hashtable responseData;
            if (requestData.Contains("owner"))
            {
                appearance = m_userDataBaseService.GetUserAppearance(new UUID((string)requestData["owner"]));
                if (appearance == null)
                {
                    responseData = new Hashtable();
                    responseData["error_type"] = "no appearance";
                    responseData["error_desc"] = "There was no appearance found for this avatar";
                }
                else
                {
                    responseData = appearance.ToHashTable();
                }
            }
            else
            {
                responseData = new Hashtable();
                responseData["error_type"] = "unknown_avatar";
                responseData["error_desc"] = "The avatar appearance requested is not in the database";
            }

            response.Value = responseData;
            return response;
        }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:30,代码来源:UserServerAvatarAppearanceModule.cs

示例14: HandleXMLRPCLogin

        public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient)
        {
            Hashtable requestData = (Hashtable)request.Params[0];
            if (m_Proxy && request.Params[3] != null)
            {
                IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]);
                if (ep != null)
                    // Bang!
                    remoteClient = ep;
            }

            if (requestData != null)
            {
                if (requestData.ContainsKey("first") && requestData["first"] != null &&
                    requestData.ContainsKey("last") && requestData["last"] != null &&
                    requestData.ContainsKey("passwd") && requestData["passwd"] != null)
                {
                    string first = requestData["first"].ToString();
                    string last = requestData["last"].ToString();
                    string passwd = requestData["passwd"].ToString();
                    string startLocation = string.Empty;
                    UUID scopeID = UUID.Zero;
                    if (requestData["scope_id"] != null)
                        scopeID = new UUID(requestData["scope_id"].ToString());
                    if (requestData.ContainsKey("start"))
                        startLocation = requestData["start"].ToString();

                    string clientVersion = "Unknown";
                    if (requestData.Contains("version") && requestData["version"] != null)
                        clientVersion = requestData["version"].ToString();
                    // We should do something interesting with the client version...

                    string channel = "Unknown";
                    if (requestData.Contains("channel") && requestData["channel"] != null)
                        channel = requestData["channel"].ToString();

                    string mac = "Unknown";
                    if (requestData.Contains("mac") && requestData["mac"] != null)
                        mac = requestData["mac"].ToString();

                    string id0 = "Unknown";
                    if (requestData.Contains("id0") && requestData["id0"] != null)
                        id0 = requestData["id0"].ToString();
                    
                    //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion);

                    LoginResponse reply = null;
                    reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient);

                    XmlRpcResponse response = new XmlRpcResponse();
                    response.Value = reply.ToHashtable();
                    return response;

                }
            }

            return FailedXMLRPCResponse();

        }
开发者ID:N3X15,项目名称:VoxelSim,代码行数:59,代码来源:LLLoginHandlers.cs

示例15: Execute

		public override object Execute(out Hashtable outputParams)
		{
			// assign output params
			outputParams = null;
			
			Hashtable outputPlaceholder = null;

			// create new XmlRpcRequest object
			XmlRpcRequest client = new XmlRpcRequest();

			// fill in the concrete method name
			client.MethodName = Call.Renderer.Voc.GetMethodCmp(Call.MethodName, Call.ObjectName);	
			
			// provide the input parameters	
			Uiml.Param[] parameters = Call.Renderer.Voc.GetMethodParams(Call.ObjectName, Call.MethodName);
			
			Type[] tparamTypes = null;
			try
			{
				tparamTypes = CreateInOutParamTypes(parameters, out outputPlaceholder);
			}
			catch(ArgumentOutOfRangeException) 
			{ 
				return null; 
			}
			
			for (int k = 0; k < parameters.Length; k++)
			{
				string propValue = (string) ((Uiml.Executing.Param) Call.Params[k]).Value(Call.Renderer);
				client.Params.Add(Call.Renderer.Decoder.GetArg(propValue, tparamTypes[k]));
			}

			if (m_request == null || !client.ToString().Equals(m_request.ToString()))
			{
				XmlRpcResponse response = client.Send(m_url);
				
				// cache response and request
				m_request = client;
				m_response = response;
			}
			
			if (m_response.IsFault)
			{
				Console.WriteLine("Fault {0}: {1}", m_response.FaultCode, m_response.FaultString);
				return null;
			}
			else
			{
				return m_response.Value;
			}
		}
开发者ID:jozilla,项目名称:Uiml.net,代码行数:51,代码来源:XmlRpcCaller.cs


注:本文中的Nwc.XmlRpc.XmlRpcRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。