{"id":34,"date":"2009-03-19T23:25:00","date_gmt":"2009-03-19T22:25:00","guid":{"rendered":"\/post\/2009\/03\/19\/Using-the-Agent-WebService-of-the-Response-Group-Service.aspx"},"modified":"2014-02-22T21:55:33","modified_gmt":"2014-02-22T20:55:33","slug":"using-the-agent-webservice-of-the-response-group-service","status":"publish","type":"post","link":"https:\/\/cymbeline.ch\/2009\/03\/19\/using-the-agent-webservice-of-the-response-group-service\/","title":{"rendered":"Using the Agent WebService of the Response Group Service"},"content":{"rendered":"
Your Office Communications Server 2007 R2, Response Group Service deployment comes with a tiny but nice little addition: the Agent WebService. It basically offers exactly the same data and functionality as the Agent OC tab but does this through a SOAP interface. If you have RGS deployed on a pool with the FQDN ‘ocs-pool-01.contoso.com’, you’ll find the Agent OC tab at https:\/\/ocs-pool-01.contoso.com\/Rgs\/Clients\/Tab.aspx<\/a>. The Agent WebService is then located at https:\/\/ocs-pool-01.contoso.com\/Rgs\/Clients\/ProxyService.asmx<\/a>. If you are running the OCS WebComponents on other machines than the front ends, then the host name is the FQDN of the WebComponents machine\/farm. So here’s how you can write your own client to sign in\/out with RGS Agent Groups. The TechNet article Deploying Response Group Clients<\/a> gives more information about deploying RGS Clients, with focus on the Agent OC Tab.<\/p>\n The first thing you typically want to do is to actually generate the proxy code which you will compile into your own client. You do so by calling<\/p>\n This will generate the RgsAgentService.cs file which you can include into your project and use right away. Web Services Description Language Tool (Wsdl.exe)<\/a> on MSDN has more info on wsdl.exe if needed.<\/p>\n Now you’re already good to go and use the web service. The code below shows a sample console application which does the following.<\/p>\n Running this program will yield something similar to the following.<\/p>\n The WebService has a few more methods. These are in particular<\/p>\n These methods all return a boolean which indicates success (true) or failure (false).<\/p>\n You can integrate the RGS Agent Services into your own application by using the corresponding web service which is installed with the Response Group Service. This allows you to offer the same information and functionality as the RGS Agent OC Tab in a customizable manner.<\/p>\n <\/p>","protected":false},"excerpt":{"rendered":" Your Office Communications Server 2007 R2, Response Group Service deployment comes with a tiny but nice little addition: the Agent WebService. It basically offers exactly the same data and functionality as the Agent OC tab but does this through a SOAP interface. If you have RGS deployed on a pool with the FQDN ‘ocs-pool-01.contoso.com’, you’ll … Continue reading “Using the Agent WebService of the Response Group Service”<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[61],"tags":[12,26,32,34,42],"yoast_head":"\nGenerating the Client Proxy<\/h2>\n
\r\nwsdl.exe \/namespace:RgsAgentService \/language:cs \/out:RgsAgentService.cs https:\/\/ocs-pool-01.contoso.com\/Rgs\/Clients\/ProxyService.asmx?wsdl\r\n<\/pre>\n
Using the Web Service<\/h2>\n
\n
\n
\n
\r\nusing System;\r\nusing System.Collections.Generic;\r\n\r\nusing RgsAgentService;\r\n\r\nnamespace RgsClient\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n string poolFqdn = "ocs-pool-01.contoso.com";\r\n\r\n if (args.Length > 0)\r\n {\r\n poolFqdn = args[0];\r\n }\r\n\r\n ProxyService service = ConnectToPool(poolFqdn);\r\n\r\n \/\/ First, figure out if the current user is an Agent.\r\n if (!service.IsAgent())\r\n {\r\n Console.WriteLine("You are not an agent in Pool '{0}'.", poolFqdn);\r\n return;\r\n }\r\n\r\n \/\/ Now get some information about the Agent (i.e. the current User).\r\n AcdAgent self = service.GetAgent();\r\n\r\n Console.WriteLine("You were authenticated as agent '{0}' ('{1}') in pool '{2}'.",\r\n self.DisplayName, self.SipAddress, poolFqdn);\r\n Console.WriteLine();\r\n\r\n \/\/ Finally, determine which Agent Groups this Agent belongs to.\r\n AcdGroup[] agentGroups = service.GetGroups();\r\n\r\n Console.WriteLine("Agent Group Name Formal? Signed In? # Agents");\r\n Console.WriteLine("----------------------------------------------------------------");\r\n\r\n Dictionary<string, Guid> agentGroupIdsForSignIn = new Dictionary<string, Guid>();\r\n\r\n for (int i = 0; i < agentGroups.Length; i++)\r\n {\r\n Console.WriteLine("{0,-32} {1,-8} {2,-10} {3,8}",\r\n agentGroups[i].Name, agentGroups[i].CanSignIn,\r\n agentGroups[i].IsSignedIn, agentGroups[i].NumberOfAgents);\r\n\r\n if (agentGroups[i].CanSignIn &&\r\n !agentGroups[i].IsSignedIn)\r\n {\r\n agentGroupIdsForSignIn.Add(agentGroups[i].Name, agentGroups[i].Id);\r\n }\r\n }\r\n\r\n \/\/ If the Agent is not signed in to all his formal groups, then offer\r\n \/\/ him to do so now.\r\n if (agentGroupIdsForSignIn.Count > 0)\r\n {\r\n Console.WriteLine();\r\n Console.WriteLine("You are not currently signed in to {0} agent group(s):",\r\n agentGroupIdsForSignIn.Count);\r\n\r\n foreach (string agentGroupName in agentGroupIdsForSignIn.Keys)\r\n {\r\n Console.WriteLine(" {0}", agentGroupName);\r\n }\r\n\r\n Console.WriteLine();\r\n Console.Write("Do you want to sign in to these groups now? [y\/n] ");\r\n\r\n ConsoleKeyInfo key = Console.ReadKey();\r\n while (key.KeyChar != 'y' && key.KeyChar != 'n')\r\n {\r\n key = Console.ReadKey();\r\n }\r\n\r\n if (key.KeyChar == 'n')\r\n {\r\n return;\r\n }\r\n\r\n Console.WriteLine();\r\n\r\n if (service.SignInMultiple(agentGroupIdsForSignIn.Values.ToArray()))\r\n {\r\n Console.WriteLine("You have successfully signed in.");\r\n }\r\n else\r\n {\r\n Console.WriteLine("Sign-in to at leat one agent group has failed.");\r\n }\r\n }\r\n }\r\n\r\n private static ProxyService ConnectToPool(string poolFqdn)\r\n {\r\n ProxyService service = new ProxyService();\r\n\r\n service.Url = String.Format("https:\/\/{0}\/Rgs\/Clients\/ProxyService.asmx", poolFqdn);\r\n service.UseDefaultCredentials = true;\r\n\r\n return service;\r\n }\r\n }\r\n}\r\n<\/pre>\n
\r\nYou were authenticated as agent 'Bob' ('bob@contoso.com') in pool 'rgs-pool-01.contoso.com'.\r\n\r\nAgent Group Name Formal? Signed In? # Agents\r\n----------------------------------------------------------------\r\nPayroll Questions False True 5\r\nGeneral HR Questions True False 8\r\n\r\nYou are not currently signed in to 1 agent group(s):\r\n General HR Questions\r\n\r\nDo you want to sign in to these groups now? [y\/n] y\r\nYou have successfully signed in.\r\n<\/pre>\n
More Methods<\/h2>\n
\n
Summary<\/h2>\n