W3Schools
home HOME Tutorials | References | Examples | Forum | About
Search W3Schools :

Web Services Basic
WS Home
WS Intro
Why WS?
WS Platform
WS Example
WS Use
WS Summary

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

W3Schools Tutorials
W3Schools Forum

Helping W3Schools

Web Service Use

back next

Using your example ASP.NET Web Service

In the previous example we created an example Web Service.

The Fahrenheit to Celsius function can be tested here: FahrenheitToCelsius.

The Celsius to Fahrenheit function can be tested here: CelsiusToFahrenheit.


These functions will send you a XML reply.

These tests use HTTP POST and will send a XML response like this:

<?xml version="1.0" encoding="utf-8" ?> 
<string xmlns="http://tempuri.org/">38</string>


Use a form to access a Web Service.

Using a form and HTTP POST, you can put the web service on your site, like this:

Fahrenheit to Celsius:
Celsius to Fahrenheit:


Use a form to access the Web Service.

Here is the code to add the Web Service to a web page:

<form target="_blank" action='http://www.example.com
/webservices/tempconvert.asmx/FahrenheitToCelsius' 
method="POST"> 
<table>
  <tr>
    <td>Fahrenheit to Celsius:</td>
    <td><input class="frmInput" type="text" 
    size="30" name="Fahrenheit"></td>
  </tr>
  <tr>
    <td></td>
    <td align="right"> <input type="submit" 
    value="Submit" class="button"></td>
  </tr>
</table>
</form>

<form target="_blank" action='http://www.example.com
/webservices/tempconvert.asmx/CelsiusToFahrenheit' 
method="POST"> 
<table>
  <tr>
    <td>Celsius to Fahrenheit:</td>
    <td><input class="frmInput" type="text" 
    size="30" name="Celsius"></td>
  </tr>
  <tr>
    <td></td>
    <td align="right"> <input type="submit" 
    value="Submit" class="button"></td>
  </tr>
</table>
</form>

Substitute the www.example.com in the code above with the name of your web site.

back next


FUNC Cheap Flights


diploma   

Get Your Diploma!

W3Schools' Online Certification Program is the perfect solution for busy professionals who need to balance work, family, and career building.

The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.

The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.



Jump to: Top of Page or HOME or Printer Friendly Printer friendly page

W3Schools provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2008 by Refsnes Data. All Rights Reserved.

Validate Validate W3C-WAI level A conformance icon W3Schools was converted to XHTML in December 1999