Web Service Use
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:
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.
 |
|
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.
|
|