Identify parameters and results

Once you have identified your web service you need to find out how it will be used. In most cases web services have a set of functions (or in simple cases just one function). Each function may accept a set of parameters and will perform its function returning some value (which may be structured in some way). ASP.NET web services provide a useful human interface for evaluating the services and determining how to use them. Web services in other languages may need a more mechanised approach using the development tools to allow you to figure out how they work. If you are lucky there will be online help associated with each web service.

For example Amazon, PayPal and Google web services have comprehensive online documentation available for developers who wish to use the services. We will look at some simple ASP.NET web services.

Example 1: Global Weather

The web service interface on http://www.webservicex.net/globalweather.asmx display the set of functions, in this case GetCitiesByCountry and GetWeather. In session 1 we looked at the GetWeather function which required two parameters and returned a string which was an XML representation of the weather in the requested city. The simple test form can be used to get a feel for the way in which the function works, but a more detailed formal description is found in the SOAP interface and the WSDL schema. We don't necessarily need to know too much about SOAP and WSDL as the development tools can take care of handling all the required interactions with the web service. The important thing is to know the input parameters and the structure of the returned results.

In this case the input parameters are called CityName and CountryName.

Example 2: Currency Converter

If we check out the web service interface on http://www.webservicex.net/CurrencyConvertor.asmx we will see that there is just one function called ConversionRate. The function makes use of some coded three letter currency codes (e.g. USD, GBP, EUR). By clicking on the ConversionRate link we see the test form which tells us that the function requires two parameters (FromCurrency and ToCurrency). The function returns a floating point number in double format which is the current conversion rate between the two currencies.

Example 3: Validate Email Address

The web service interface on http://www.webservicex.net/ValidateEmail.asmx shows us that there is a single function called IsValidEmail. The function takes a single parameter called Email and returns a boolean (true/false) result.

Valid XHTML 1.0! | Valid CSS! | WCAG Approved AA
Page design by: John P Scott - Hosting with: Netcetera