Connections Online Web Services (COWS)

Demo 1 - Using Visual Studio 2010

This demo shows how to use Visual Studio 2010 to connect to the Connections Online Web Services - Read Service and return a list of projects for an entire site.

The demo application was developed in Microsoft Visual Studio 2010 Ultimate. The same application could be created in Visual Studio 2008 as well, including the free Express Web Developer version. For information about the free Express versions, see microsoft.com/express.

The basic steps we used to create the example:

  1. Create a new, blank Web Application in Visual Studio
  2. Add a new Service Reference to the site and point it to https://cows.connectionsonline.net/Read.svc. In this example, we set the namespace of the reference to ReadCows.
  3. Add a new Web Form to the site
  4. Add two textboxes, a button, and a grid to the form.
  5. In the code-behind for the Web Form, wire up the datasource for the grid to be filled in from the Web Service when the user name and password are entered into the textboxes and the button is clicked.

That's it! The whole process really only requires one function of actual code:

Visual Basic

Protected Sub Update_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Update.Click

	Dim c As New ReadCows.ReadClient()
	Dim p() As ReadCows.Project

	c.ClientCredentials.UserName.UserName = UserName.Text
	c.ClientCredentials.UserName.Password = Password.Text

	p = c.ReadProjects(Nothing, Nothing, Nothing, 0)

	c.Close()

	GridView1.DataSource = p
	GridView1.DataBind()

End Sub

C#

protected void Update_Click(object sender, EventArgs e)
{
	ReadCows.ReadClient c = new ReadCows.ReadClient();
	ReadCows.Project[] p;

	c.ClientCredentials.UserName.UserName = UserName.Text;
	c.ClientCredentials.UserName.Password = Password.Text;

	p = c.ReadProjects(null, null, null, 0);

	c.Close();

	GridView1.DataSource = p;
	GridView1.DataBind();
			
}

Download

Download the sample code here: WS-Demo1.zip