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

作者:唐伯虎点蚊香,如若转载,请注明出处:https://www.web176.com/webservice/10476.html

(0)
打赏 支付宝 支付宝 微信 微信
唐伯虎点蚊香的头像唐伯虎点蚊香
上一篇 2023年2月24日
下一篇 2023年2月24日

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注