自强学堂
自强学堂:学习、分享、让你更强!
Web Services 实例HTMLCSSJAVASCRIPTJQUERYSQLPHPBOOTSTRAPANGULARXML
 

Web Services – 如何使用

使用我们的 ASP.NET Web Service 例子

在上一节,我们创建了一个 Web Service 的例子

请在此测试华氏度转换摄氏度函数:华氏度转换为摄氏度

请在此测试摄氏度转换华氏度函数:摄氏度转换为华氏度

本测试使用 HTTP POST,会发送类似这样的 XML 响应:

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


使用表单来访问 Web Service

通过使用表单和 HTTP POST,您可以把 web service 置于您的站点上,比如这样: 华氏度转换为摄氏度:

华氏度转换为摄氏度:
摄氏度转换为华氏度:


您可以把 web service 置于您的站点上

您可以使用这些代码把 web service 放置在您的站点上:

<form action='tempconvert.asmx/FahrenheitToCelsius'
method="post" target="_blank">
<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 action='tempconvert.asmx/CelsiusToFahrenheit'
method="post" target="_blank">
<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>

服务器上的 "tempconvert.asmx" 的地址类似如下地址:

http://www.example.com/webservices/tempconvert.asmx