コード例 #1
0
        private static void CallWithLargeMessage()
        {
            using (CategoryInformationServiceClient
                   client = new CategoryInformationServiceClient("WSHttpBinding_ICategoryInformationService"))
            {
                try
                {
                    var description = new System.Text.StringBuilder();
                    for (int i = 0; i < 819; i++)
                    {
                        description.Append("0123456789");
                    }
                    description.Append("123");

                    var response = client.GetCategoryInformation(new CategoryInformationRequest
                    {
                        CategoryId  = 1,
                        Description = description.ToString()
                    });

                    PrintResponse(response);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }

                Console.ReadLine();
            }
        }
コード例 #2
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Press [ENTER] to call CategoryInformationService");
            Console.ReadKey();

            using (CategoryInformationServiceClient client = new CategoryInformationServiceClient("WSHttpBinding_ICategoryInformationService"))
            {
                client.GetCategoryInformationCompleted
                    += new EventHandler <GetCategoryInformationCompletedEventArgs>(client_GetCategoryInformationCompleted);
                var objSync = new Object();
                client.GetCategoryInformationAsync(new CategoryInformationRequest
                {
                    CategoryId = 1
                });

                Console.WriteLine("Press [ENTER] to close client");
                Console.ReadKey();
            }
        }