Esempio n. 1
0
        /// <summary>
        /// load files from FieldManagmentService
        /// </summary>
        /// <param name="service"></param>
        private static void CallFieldManagementService(ServiceConfig service)
        {
            var crmOnDemandFieldManagementService = new CrmOnDemandFieldManagementService.FieldManagementService();

            var requestContext = crmOnDemandFieldManagementService.RequestSoapContext;

            UsernameToken userToken = new UsernameToken(service.Username, service.Password, PasswordOption.SendPlainText);

            requestContext.Security.Tokens.Add(userToken);

            var fieldManagementReadAll_Input = new CrmOnDemandFieldManagementService.FieldManagementReadAll_Input();
            fieldManagementReadAll_Input.IncludeAll = true;

            log.Info("Making service call to " + FIELD_MANAGEMENT_READ_ALL);
            var fieldManagementReadAll_Output = crmOnDemandFieldManagementService.FieldManagementReadAll(fieldManagementReadAll_Input);

            log.Debug("Service call to " + FIELD_MANAGEMENT_READ_ALL + " returned successfully");

            XmlTextWriter writer = new XmlTextWriter(service.ResponseFileName, null);
            writer.Formatting = Formatting.Indented;
            crmOnDemandFieldManagementService.ResponseSoapContext.Envelope.WriteContentTo(writer);
            writer.Flush();

            var msg = FIELD_MANAGEMENT_READ_ALL + " output saved to file: " + service.ResponseFileName;
            log.Info(msg);
            Console.WriteLine(msg);
        }
Esempio n. 2
0
        /// <summary>
        /// load files from FieldManagmentService
        /// </summary>
        /// <param name="service"></param>
        private static void CallFieldManagementService(ServiceConfig service)
        {
            var crmOnDemandFieldManagementService = new CrmOnDemandFieldManagementService.FieldManagementService();

            var requestContext = crmOnDemandFieldManagementService.RequestSoapContext;

            UsernameToken userToken = new UsernameToken(service.Username, service.Password, PasswordOption.SendPlainText);

            requestContext.Security.Tokens.Add(userToken);

            var fieldManagementReadAll_Input = new CrmOnDemandFieldManagementService.FieldManagementReadAll_Input();

            fieldManagementReadAll_Input.IncludeAll = true;

            log.Info("Making service call to " + FIELD_MANAGEMENT_READ_ALL);
            var fieldManagementReadAll_Output = crmOnDemandFieldManagementService.FieldManagementReadAll(fieldManagementReadAll_Input);

            log.Debug("Service call to " + FIELD_MANAGEMENT_READ_ALL + " returned successfully");

            XmlTextWriter writer = new XmlTextWriter(service.ResponseFileName, null);

            writer.Formatting = Formatting.Indented;
            crmOnDemandFieldManagementService.ResponseSoapContext.Envelope.WriteContentTo(writer);
            writer.Flush();

            var msg = FIELD_MANAGEMENT_READ_ALL + " output saved to file: " + service.ResponseFileName;

            log.Info(msg);
            Console.WriteLine(msg);
        }