Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

This sample depicts the behavior of a simple voting system. It has two perspectives: , which are namely a user perspective and an administration perspective.

...

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 which that includes the linemessage, "We have already received a vote for this poll from your IP address. Therefore, you are not eligible for voting" below the results graph.

Deploying the

...

service

Info

You need Apache Ant

...

  1.6.2 or higher to build the sample.

You can find the sample discussed here in the <AS_HOME>/samples/Chad  directory.  

  The steps are as follows:

  1. Download the WSO2 Application Server. For instructions see, Downloading the Product.

...

  1. In a command prompt, switch to the

...

  1. samples directory.
    For example, in Windows: 

    Code Block
    cd <AS_HOME>\samples\Chad

3. From there, type ant.

4. Run the WSO2 Application Server start script.

...

  1. Enter the following command:

    Code Block
    ant
  2. Start the WSO2 Application Server by executing one of the following commands, where  <PRODUCT_HOME>  is the directory where you installed the product distribution:

    OSCommand
    On Windows
    <PRODUCT_HOME>\bin\wso2server.bat --run
    On Linux/Solaris
    sh <PRODUCT_HOME>/bin/wso2server.sh

    Anchor
    5-6
    5-6

  3. Check the WSO2 Application Server instance using this URL: https://localhost:9443/carbon

...

  1. You now have the Chad service deployed on WSO2 Application Server.

...

  1. 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

...

  1. steps 5 & 6 above.

...

  1. To run the chad client visit http://localhost:9763/Chad. This is the web-based UI of chad application.

    Info

...

  1. Using Mozilla Firefox is recommended when running this sample.

...

  1. The user view of the Chad system appears.

    Image Modified

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. If
    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, you cansee the poll results.

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 noone 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, using which one where you can vote for his/her 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.