Unknown macro: {next_previous_links}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

This sample is a combination of a web app and Axis2 sample, and it depicts the behavior of a simple voting system. It has two perspectives, which are namely a user perspective and an administration perspective.

The user perspective:

  • Is the default perspective
  • Allows a user to vote for a particular poll
  • Allows a user to view the results of a poll

In the administration perspective, an authorized administrator can:

  • Create new polls
  • Start polls (which have been stopped)
  • Stop polls (which are currently active)
  • Create accounts for new administrators

Only one vote per poll is allowed for a particular IP address and the poll results can be compared using the bar graphs and the relevant percentages of votes each choice has received. If you try voting again using the same IP, you will be directed to the poll results page that includes the message, "We have already received a vote for this poll from your IP address. Therefore, you are not eligible for voting" below the results graph.

Building the sample

The polling station sample is located in <AS_HOME>\Samples\Chad directory.

  1. For more information, see Building Axis2 Samples.

  2. Check the WSO2 Application Server instance using this URL: https://localhost:9443/carbon 
    You now have the Chad service deployed on WSO2 Application Server.

  3. On the Main menu, under Services, click List.
    The Deployed Services page will appear with the Chad service listed as deployed.

Running the web-based client

  1. Start the WSO2 Application Server if it is not running and ensure that the Chad service is running as explained in steps 2 & 3 above.
  2. To run the chad client visit http://localhost:9763/Chad. This is the web-based UI of chad application.

    Using Mozilla Firefox is recommended when running this sample.

  3. The user view of the Chad system appears.

If there are no Active polls, the page shows "No polls present". An active poll is a poll open for voting. A normal user can vote using the Vote action. He/she can also see poll results by clicking on the particular poll title.

Login to the Chad system as Administrator using the default username and password given. Admin has access to the following features:

  • Create a new poll.
  • Stop voting or remove a poll.
    You can see the poll results, if you click on the name of a poll in the active polls lists that are open for voting.

Vote types available are "Single Choice" where only one choice can be voted and "Multiple Choice" where the user can vote for one or more choices. Once a poll is created, it is automatically open for voting. Voting is open until explicitly closed using stop option.

The menu item All Polls lists all created polls.

To see Poll results, click on the particular poll listed on any of the Polls lists pages. You will get a page as shown below:

Using the Stop action, you can close voting. Once closed no one can vote for that particular poll. Once stopped, the Start link will appear under the 'Action' column replacing both the Stop and Vote action links. Start action reopens a poll for voting. While, the  Vote action takes you to a page as shown below, where you can vote for your preferred choice. This can happen for either a single type vote or a multiple type vote.

For single type voting:

For multiple type voting:

  • Stopped polls : List polls that are closed for voting (polls that one cannot vote for).
  • Administrators - Allow the user to add new administrators.

Using this option, you can add new administrators and check the list of current administrators.

The WSDL file of the sample can be found in <AS_HOME>\samples\Chad\wsdl directory.

  • No labels