private static string TranslateMethod(string authToken, string sourceText)
        {
            // Add TranslatorService as a service reference, Address:http://api.microsofttranslator.com/V2/Soap.svc
            TranslatorService.LanguageServiceClient client = new TranslatorService.LanguageServiceClient();
            //Set Authorization header before sending the request
            HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();

            httpRequestProperty.Method = "POST";
            httpRequestProperty.Headers.Add("Authorization", authToken);

            // Creates a block within which an OperationContext object is in scope.
            using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
            {
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
                //string sourceText = "<UL><LI>Use generic class names. <LI>Use pixels to express measurements for padding and margins. <LI>Use percentages to specify font size and line height. <LI>Use either percentages or pixels to specify table and container width.   <LI>When selecting font families, choose browser-independent alternatives.   </LI></UL>";
                string translationResult;
                //Keep appId parameter blank as we are sending access token in authorization header.
                translationResult = client.Translate("", sourceText, "en", "hi", "text/html", "general");
                //Console.WriteLine("Translation for source {0} from {1} to {2} is", sourceText, "en", "de");
                //Console.WriteLine(translationResult);
                //Console.WriteLine("Press any key to continue...");
                //Console.ReadKey(true);
                return(translationResult);
            }
        }
        private static void AddTranslationMethod(string authToken, string sourcetextforadd)
        {
            // Add TranslatorService as a service reference, Address:http://api.microsofttranslator.com/V2/Soap.svc
            TranslatorService.LanguageServiceClient client = new TranslatorService.LanguageServiceClient();
            //Set Authorization header before sending the request
            HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();

            httpRequestProperty.Method = "POST";
            httpRequestProperty.Headers.Add("Authorization", authToken);

            // Creates a block within which an OperationContext object is in scope.
            using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
            {
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
                //string sourcetextforadd = "una importante contribución a la rentabilidad de la empresa";
                try
                {
                    //Keep appId parameter blank as we are sending access token in authorization header.
                    client.AddTranslation("", sourcetextforadd, "an important contribution to the company profitability.", "en", "hi", 1, "text/plain", "general", "TestUserID", null);
                    Console.WriteLine("Your translation for {0} has been added", sourcetextforadd);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("An error occurred while adding translation. " + ex.Message);
                }
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
            }
        }