Example #1
0
        static void Main(string[] args)
        {
            var client = new ServiceReference1.PersonManagerSyncPortTypeClient();

            client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
            client.ClientCredentials.UserName.UserName = "******";
            client.ClientCredentials.UserName.Password = "******";

            // Create person
            var sourceId = Guid.NewGuid();
            var hdr      = new imsx_RequestHeaderInfoType();
            var req      = new createPersonRequest();

            req.personRecord = UserMapper.MapToRecord(new User {
                SourceId = sourceId.ToString(), FirstName = "Vlad", LastName = "Ogay", Language = "en"
            });
            client.createPerson(hdr, req);

            // Read person that we've just created
            var req2 = new readPersonRequest {
                sourcedId = sourceId.ToString()
            };
            readPersonResponse resp2;

            client.readPerson(hdr, req2, out resp2);
        }
Example #2
0
        private void button1_Click(object sender, EventArgs ea)
        {
            var client = new SampleServiceClient.ServiceReference1.PersonManagerSyncPortTypeClient();

            client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
            client.ClientCredentials.UserName.UserName = "******";
            client.ClientCredentials.UserName.Password = "******";

            // Create person
            var sourceId = Guid.NewGuid();
            var hdr      = new imsx_RequestHeaderInfoType();
            var req      = new createPersonRequest();

            req.personRecord = UserMapper.MapToRecord(new User {
                SourceId = sourceId.ToString(), FirstName = "Vlad", LastName = "Ogay", Language = "en"
            });

            textBox1.Text += "=== CreatePerson ===";
            try
            {
                client.createPerson(hdr, req);
                textBox1.Text += Environment.NewLine;
                textBox1.Text += "OK";
            }
            catch (Exception e)
            {
                textBox1.Text += Environment.NewLine;
                textBox1.Text += e.Message;
                if (e.InnerException != null)
                {
                    textBox1.Text += Environment.NewLine;
                    textBox1.Text += e.InnerException.Message;
                    if (e.InnerException.InnerException != null)
                    {
                        textBox1.Text += Environment.NewLine;
                        textBox1.Text += e.InnerException.InnerException.Message;
                    }
                }
            }

            // Read person that we've just created
            var req2 = new readPersonRequest {
                sourcedId = sourceId.ToString()
            };
            readPersonResponse resp2;

            textBox1.Text += Environment.NewLine;
            textBox1.Text += Environment.NewLine;
            textBox1.Text += "=== ReadPerson ===";
            try
            {
                client.readPerson(hdr, req2, out resp2);
                textBox1.Text += Environment.NewLine;
                textBox1.Text += "OK";
            }
            catch (Exception e2)
            {
                textBox1.Text += Environment.NewLine;
                textBox1.Text += e2.Message;
                if (e2.InnerException != null)
                {
                    textBox1.Text += Environment.NewLine;
                    textBox1.Text += e2.InnerException.Message;
                }
            }
        }