Creating a Web Service with Web Matrix - Second example: the Pythagoras Theorem
(Page 3 of 4 )
The web service we create will return the hypotenuse, the longest side of a right angled triangle, c shown in the figure if the values of the sides "b" and "a" are known. This comes through the equation which shows that a, b and c are related by:
c=square root( a * a + b * b).
The web service shown in the next picture will deliver the measure of the hypotenuse to the client, provided the client supplies the sides a and b.

In order to use the mathematics function sqrt, the class System.Math was included using the imports System.Math statement at the top of the page. However, this did not allow returning just sqrt (a*a + b * b). Hence a full reference was given in the return statement.
Next: Testing this web service >>
More XML Articles
More By Jayaram Krishnaswamy