Ejemplo n.º 1
0
        private void cmdUpload_ServerClick(object sender, System.EventArgs e)
        {
            // Check if a file was submitted.
            if (Uploader.PostedFile.ContentLength != 0)
            {
                try
                {
                    EmployeesServiceWse proxy = new EmployeesServiceWse();

                    // Create the attachment.
                    // You can use either a file path or an open stream.
                    string         fileName   = Path.GetFileName(Uploader.PostedFile.FileName);
                    DimeAttachment attachment = new DimeAttachment(fileName,
                                                                   TypeFormat.MediaType, Uploader.PostedFile.InputStream);
                    proxy.RequestSoapContext.Attachments.Add(attachment);

                    // Upload the attachment.
                    proxy.UploadFile(fileName);

                    lblStatus.InnerText = "Thanks for submitting your file";
                }
                catch (Exception err)
                {
                    lblStatus.InnerText = err.Message;
                }
            }
        }
Ejemplo n.º 2
0
        private void cmdGetEmployees_Click(object sender, System.EventArgs e)
        {
            // Create the proxy.
            EmployeesServiceWse proxy = new EmployeesServiceWse();

            proxy.RequestSoapContext.Security.Tokens.Add(
                new UsernameToken("dan",
                                  "secret",
                                  PasswordOption.SendHashed));

            // Bind the results.
            dataGrid1.DataSource = proxy.GetEmployees().Tables[0];
        }
Ejemplo n.º 3
0
	protected void cmdCallWith_Click(object sender, EventArgs e)
	{
		EmployeesServiceWse proxy = new EmployeesServiceWse();

		//Uri newUrl = new Uri(proxy.Url);
		//proxy.Url = newUrl.Scheme + "://" + newUrl.Host + ":8080" + newUrl.AbsolutePath;

		// Add the WS-Security token.
		proxy.RequestSoapContext.Security.Tokens.Add(
		  new UsernameToken("dan", "secret", PasswordOption.SendPlainText ));

		GridView1.DataSource = proxy.GetEmployeesWseSecured();
		GridView1.DataBind();
	}