Documentation

##### WSO2 WSAS 2.1-RC6

- Contents
- Home

##### Downloads

- Releases

##### Documentation

- User Guide
- FAQs
- Installation Guide
- Source
- Running Behind a Proxy
- Data Services Guide
- EJB Guide
- Clustering Guide
- XKMS Guide
- Changing Keys

##### Samples

- Chad
- Commodity Quote
- Data Services
- Flickr
- Javascript
- STS
- Trader
- Tiny URL

##### API Documentation

- Java Docs

##### Tools

- Code Generation
- Change Password
- Eclipse IDE Integration
- TCP Monitor
- WSDL2Code
- WSDL View
- Try It
- AAR Validation
- MAR Validation

##### Resources

- News

##### Get Involved

- Mailing Lists
- Release Process
- Integration

##### Project Information

- Project Team
- Issue Tracking
- License

# Chad Sample Guide

## INTRODUCTION

Chad is a simple voting service. It has two perspectives; a user perspective & an administration perspective. The user perspective is the default one, which allows a user to vote for a particular poll, as well as view the results of a poll. In addition, 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, also including the line, "We have already received a vote for this poll from your IP address. Hence you are not eligible for voting" below the results graph.

## DEFINITIONS

- WSO2WSAS_HOME : Directory to which you installed WSO2 WSAS.
- MGT_CONSOLE_URL : This is the URL that will be used to access the management console. This will be https://127.0.0.1:9443/ in the case of the standalone distribution and https://127.0.0.1:9443/wso2wsas in the case of the embedded distribution (assuming WSO2 WSAS default configuration parameters). This can vary depending on your installation type and the configuration.
- CHAD_URL : This URL is used to open the CHAD GUI Application. This will be http://127.0.0.1:9762/wservices/Chad for the standalone server of WSAS and http://127.0.0.1:9762/wso2wsas/wservices/Chad for the servlet.

## DEPLOYING THE CHAD SERVICE

To build the samples you need the Apache Ant build tool.

- First install WSO2 WSAS (See Installation Guide for details).
- In the command prompt go to `WSO2WSAS_HOME/samples/Chad` .
- Type `ant` at the command prompt.
- Execute the WSO2 WSAS starting script.
- Check your WSO2 WSAS instance using this URL https://localhost:9443

Now you will have the Chad service deployed on WSO2 WSAS. You can check this by going to the AJAX based Management Console and clicking on the "Manage Services" link on the left menu. If you see the Chad service listed here, then you know for sure that Chad is active/deployed.

## RUNNING THE WEB BASED CHAD CLIENT

You can run the client using a Web browser interface.

- Run the WSO2 WSAS Server (See Installation Guide for instructions on installation)
- Go to CHAD_URL (e.g. http://127.0.0.1:9762/wservices/Chad for the standalone server and http://127.0.0.1:9762/wso2wsas/wservices/Chad for the servlet) or You can got to the WSO2 WSAS Management Console, sign in, then click on "Manage Services" link on the left menu. As Chad service is already deployed you will see the service listed on the page. Click on "Chad" service link and you will go to a "Service Management" page of Chad. You should be able to see a sub menu titled "Application GUI" here. This sub menu will take you to the Web based UI of the Chad application. (See Administrator Guide for details for details)
- Now you will see the user view of the Chad system as shown below. If there are no Active polls, then the page will read as "There are no active polls". An active poll is a poll open for voting. A normal user can vote using the "Vote" action. He can also see poll results by clicking on the particular poll title.
- Do an Administrator Login with the given default username and password to have access to administrator privileges to the Chad system. Once logged in as Admin you will have access to the following features
  - Active polls- lists polls that are open for voting. Here you have the option of either stopping the poll or voting . If you click on the name of the poll it will list the poll results
  - Create a poll
  Vote types available are 'Single Choice' where one can only vote for a single choice and 'Multiple Choice' where one can vote for one or more choices. Note: Once a poll is created it is automatically open for voting. Voting is open until explicitly closed using stop option
  - All Polls - lists all polls created
  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 after which one cannot vote for that particular poll. Once stopped, the Start link will appear under 'Actions' column replacing both Stop and Vote action links. Start action reopens a poll for voting. Vote action will take you to a page as shown below from which one can vote for his/her preferred choice. This can happen for either a single type vote or a multiple type vote . For single type vote: For multiple type vote:

  - Stopped polls- lists polls that have been closed for voting (polls that one cannot vote for).
  - Administrators - allows the user to add new administrators
  Using this option you can add new administrators, as well as check the list of current administrators.

## APPENDIX

- WSDL for Chad sample - Chad.wsdl