加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

.Net 2.0 WebService传递参数的问题

发布时间:2020-12-17 01:25:24 所属栏目:安全 来源:网络整理
导读:using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] //[WebServiceBi

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//[WebServiceBinding(ConformsTo = WsiProfiles.None)]
//[SoapRpcService(RoutingStyle = SoapServiceRoutingStyle.SoapAction)]

public class Service : System.Web.Services.WebService
{
??? public Service () {

??????? //Uncomment the following line if using designed components
??????? //InitializeComponent();
??? }

??? [WebMethod]
??? public string HelloWorld() {
??????? return "Hello World";
??? }
??? [WebMethod(Description = "加法测试")]
??? public? int Count(int x,int y)
??? {
??????? return x + y;
??? }
??? [WebMethod(Description = "上传测量记录")]
??? public int Upload(string data)
??? {
??????? return 1;
??? }
??
}

如果红字部分打开,则是采用RPC方式传递参数,缺省的BCB就是这样处理的,否则是采用Document|Literal 方式传递,BCB自动生成的代码要加上InvRegistry()->RegisterInvokeOptions(__interfaceTypeinfo(ServiceSoap),ioDocument);才可以正确传递参数。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读