RollDice Demo

Interlocking Applications logo

This page demonstrates the use of the wsDice Web Service's RollDice operation. The general flow is as follows:

Fill in the lowest number on the die, fill in the higest number on the die, then fill in the number of dice you want to throw. Then push "Roll Dice." The first roll may take around 30 seconds as the server sets up the service. Subsequent rolls should take less than a second.

 

Low Value: High Value: Number of Dice:
 



The service is located at http://InterlockingApplications.com/gs/wsDice.asmx Using Visual Studio, a web reference was added to this form that automatically created a proxy object that handles the communications between this web form and wsDice.

There are three text box controls that allow you to specify the values for the dice -- the lowest value on a single die, the highest value on a single die and the number of dice you wish to roll. .Net web form Validation controls are used to check the input. If you enter and illegal value, a "*" will appear next to the text box. If you push the "Roll Dice" button with an invalid input, a ValidationSummary control next to the button will display the list of errors. The constraints for input are

  • All fields must be numeric -- no more than three digits in any field
  • Low Value must be greater than zero
  • Low Value must be less than High Value
  • High Value must be greater than one
  • Number of Dice must be greater than zero and less than 100

The values are initially set to roll 5 six-sided dice.

When you click "Roll Dice," under the covers, we'use the proxy we generated for wsDice to call the method via SOAP. The results come back as an integer array and are stored in a DataSet table which is bound to the DataList control. The DataList control displays the results.

The first time you click "Roll Dice" it may take 30 seconds or so to get a response. The delay is the cost of building the service up on the server. Subsequent clicks should display in less than a second.