Web Service 的概念问题

kiba518 2010-02-05 04:01:04

以下为函数

<WebMethod()> Public Function FahrenheitToCelsius
(ByVal Fahrenheit As Int16) As Int16
Dim celsius As Int16
celsius = ((((Fahrenheit) - 32) / 9) * 5)
Return celsius
End Function

以下为调用

<form target="_blank"
action='http://w3school.com.cn/webservices/tempconvert.asmx/FahrenheitToCelsius'
method="POST">

<label>华氏度转换为摄氏度:</label>
<p>

<span>
<input class="frmInput" type="text" size="30" name="Fahrenheit">
</span>

<span>
<input type="submit" value="提交" class="button">
</span>

</p>

</form>


FROM的action在.asmx文件后加了/FahrenheitToCelsius 正好是函数名
input空件的ID正好对应传递的参数


那我是这样想的 如果新浪的.asmx文件 告诉我 他的参数 我用这样的方式提交 他也会返回我一个处理后的页面吧

新浪的天气预报也是Web Service 吧
就是说 只要知道.asmx文件和参数 就能自己设定城市天气了呗

...全文
189 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
blue_shark1977 2010-02-05
  • 打赏
  • 举报
回复
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]

你就当做是固定写法就行了,没必要知道是什么意思!
blue_shark1977 2010-02-05
  • 打赏
  • 举报
回复
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]


你就当做是固定写法就行了,没必要知道是什么意思!
kiba518 2010-02-05
  • 打赏
  • 举报
回复
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]


楼上的大哥 这几句话是什么意思呀 我菜鸟
gsz_stylm 2010-02-05
  • 打赏
  • 举报
回复

using System;
using System.Web;
using System.Collections.Generic;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using Maticsoft.BLL;
using Maticsoft.Model;
using System.Text;
using WebDataGather;

/// <summary>
/// WebService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{
private static readonly string connection = ConfigurationManager.ConnectionStrings["XYLJudgeConnectionString"].ToString();
public WebService() { }
[WebMethod]
public string insertScore(int pi, int ci, decimal sc, string str)
{
return "ok";

}
}

其实上面的就是一个webservice,然后你通过调用
kiba518 2010-02-05
  • 打赏
  • 举报
回复
楼上的太官方了 我一句没看懂
  • 打赏
  • 举报
回复
WebService不会象Aspx一样给你提交页面,它就是一系列函数,你可以在自己电脑上远程调用它,它替你执行,然后返回结果给你,WebService对所有细节进行了包装,使得就跟我们在本地机器上调用函数一样
kiba518 2010-02-05
  • 打赏
  • 举报
回复
我看的是 w3school 在线教程
感觉不够用 介绍的太少了 而且没什么例子

111,120

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧