webservice的简单介绍

本文介绍了一个具体的.NET WebService实现案例,包括Service1.cs源代码及如何通过WSDL、SOAP和UDDI等关键技术来构建和调用WebService。示例中演示了简单的HelloWorld服务,并展示了如何配置WebService的基本属性。

Web Services技术的组成要素

¢WSDL
¢SOAP
¢UDDI
 
.NET Web Service的实现
Service1.cs 

using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Data;
using System.Web.Services.Protocols;
using System.Web.Services.Description;
using Microsoft.ApplicationBlocks.ExceptionManagement;
using System.Configuration;
using System.Net;


[WebService(Namespace = "http://www.1111.com")]
//[System.Xml.Serialization.SoapIncludeAttribute(typeof(PropertyData))]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[SoapDocumentService(SoapBindingUse.Literal,
                         SoapParameterStyle.Wrapped,
                         RoutingStyle = SoapServiceRoutingStyle.RequestElement)]
public class Service1 : System.Web.Services.WebService
{

        [WebMethod]

        public string HelloWorld()

        {

            return "Hello World";

        }

    }

 

调用

 Service1.asmx

<%@ WebService Language="C#" CodeBehind="~/App_Code/Service1.cs" class="Service1" %>

 

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值