使用带验证的Web服务
来源:互联网 发布:玫瑰的名字知乎 编辑:程序博客网 时间:2024/05/03 09:26
为了安全,使用带验证的Web服务。Web服务是基于Soap协议和xml的。验证可以通过SOAP报头条目完成。下面是一个简单的例子:
1、首先创建一个继承了soapheader类
建立一个SOAPheader类 //soapheader 设置用户名和密码
public class HeadAuthentication : SoapHeader
{
public string username;
public string password;
}
2.在Web服务中中设立用户名密码
public class HeadAuthentication : SoapHeader
{
public string username;
public string password;
}
2.在Web服务中中设立用户名密码
在web 服务类中:public Authgeader myheader; [WebMethod] [SoapHeader("myheader",Direction=SoapHeaderDirection.In,Required=true)] public string HelloWorld() {//必须定义为Public类型的 if (myheader.user == "wwb" && myheader.pws == "123") { return "Hello World"; } else { return "hello Guest"; }}3.在客户端验证soapheader信息如下客户端:添加web服务testws.Service myws = new WindowsApplication5.testws.Service();testws.Authgeader myheader = new WindowsApplication5.testws.Authgeader() myheader.user = "wwb"; myheader.pws = "123"; myws.AuthgeaderValue = myheader;//添加SOAP头textBox1.Text=myws.HelloWorld();以上就是一个带验证信息的webservice最简单的做法。
- 使用带验证的Web服务
- 身份证号码验证web服务
- Web验证码的使用
- 使用Linux自带的gssftp服务
- WebService---web服务的使用
- NodeJs使用json web token验证REST服务
- python自带web服务
- 如何调用带不可信SSL证书的REST Web服务?
- java6 自带的web服务类 JAX-WS
- Web服务实现验证码
- Email 电子邮件地址验证 WEB 服务
- 开发基于Web Service的图片验证码服务
- 开发基于Web Service的图片验证码服务
- LINUX 部署 WEB.PY 验证码服务的 配置说明书
- Linux下web服务验证码不显示的问题
- input的带验证的类型的使用
- Web开发中验证控件的使用
- 天气预报的web服务的使用
- PO VO DAO POJO概念
- typedef用法[转帖]
- .NET的GridView
- FS2410自带光盘Linux内核编译问题
- Windows API一日一练(10)LoadAccelerators函数
- 使用带验证的Web服务
- 天涯上令人肝肠寸断的100个签名
- FFClickOnce
- 使用信号实现线程同步
- vc Resource栏“this file is already open in the editor”
- excel中数据类型的处理
- 天涯上令人肝肠寸断的100个签名
- SetVolumeMountPoint无法挂载
- 公司定义为开发型还是服务型???