Tuesday, November 12, 2013

QB Rating Calculator Web Service

QB Rating Web Service is a WCF service that calculates a QB's NFL and NCAA ratings.  It supports REST, SOAP, XML and JSON. It is a Visual Studio 2012 project written in C# and is another in my series of QB Ratings app samples - InfoPath 2013 QB Rating, Excel 2013 QB Rating and SharePoint 2013 QB Rating (App & App Part).
Download Web Service Source (22K) or ASP.NET QB Rating Sample (8.8M)
View CodePlex Project or MSDN Sample


  • Web Service (WCF)
  • REST and SOAP
  • XML and JSON
  • Calculates both NFL and NCAA ratings
  • Shows detailed calculation formula & steps
  • Source code included


The web service interface in the Visual Studio Object Browser:

Sample XML response from the service

The GetRating service call in the WCF Test Client:

Quick Usage Example

In order to use this service via SOAP, you'll need to create a client and use it to call the service.  Additionally, you can use the REST configuration with a ServiceContract and UriTemplate similar to http://localhost:62370/QBRatingService.svc/calc?formula=NFL&c=10&a=16&y=212&t=3&i=1&fmt=XML. You can quickly create a configuration file and simple client class using the svcutil.exe tool from the command line with the following syntax:

svcutil.exe http://localhost:62370/QBRatingService.svc?wsdl
This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:
class Test
    static void Main()
        QBRatingServiceClient client = new QBRatingServiceClient();

        // Use the 'client' variable to call operations on the service.

        // Always close the client.
Visual Basic
Class Test
    Shared Sub Main()
        Dim client As QBRatingServiceClient = New QBRatingServiceClient()
        ' Use the 'client' variable to call operations on the service.

        ' Always close the client.
    End Sub
End Class

Detailed ASP.NET Usage Example

In addition to the quick usage in the previous section, I developed a working ASP.NET QB Rating Calculator that uses this web service to perform the actual calculations. The complete Visual Studio 2012 project is available on CodePlex and MSDN.


  1. I like this article - can I use this service in my own site?

  2. If it's a commercial site, I'd just appreciate a credit somewhere. If you want to add a branch, there's a CodePlex project at https://qbratingws.codeplex.com. Thanks, Jason.