myService.asmx.cs

添加类:MyHeader 从 System.Web.Services.Protocols.SoapHeader继承

完整的代码如下


添加Soap头来增加Web Service的安全性using System;
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性
using System.Collections;
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性
using System.ComponentModel;
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性
using System.Data;
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性
using System.Diagnostics;
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性
using System.Web;
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性
using System.Web.Services;
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性
//对soap Head引用添加的命名空间
添加Soap头来增加Web Service的安全性

添加Soap头来增加Web Service的安全性
using System.Web.Services.Protocols; 
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性 
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性
namespace study
添加Soap头来增加Web Service的安全性

通过soap调用的代码如下:


添加Soap头来增加Web Service的安全性              // 在此处放置用户代码以初始化页面
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性              
//创建myService对象
添加Soap头来增加Web Service的安全性

添加Soap头来增加Web Service的安全性              MyWebServer.myService service 
= new study.MyWebServer.myService();
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性              
//创建soap头对象
添加Soap头来增加Web Service的安全性

添加Soap头来增加Web Service的安全性              MyWebServer.MyHeader header 
= new study.MyWebServer.MyHeader();
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性              
//设置soap头变量
添加Soap头来增加Web Service的安全性

添加Soap头来增加Web Service的安全性              header.PassWord 
= "admin";
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性              header.UserID 
= "admin";
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性              service.MyHeaderValue 
= header;
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性              
//调用web 方法
添加Soap头来增加Web Service的安全性

添加Soap头来增加Web Service的安全性            
this.Label1.Text = service.HelloWorld2("dob");
添加Soap头来增加Web Service的安全性
添加Soap头来增加Web Service的安全性 
添加Soap头来增加Web Service的安全性

相关文章:

  • 2021-07-17
  • 2021-11-08
  • 2021-08-31
  • 2021-11-08
  • 2022-12-23
  • 2021-07-06
  • 2022-02-17
猜你喜欢
  • 2021-07-31
  • 2021-10-01
  • 2021-11-13
  • 2022-02-14
相关资源
相似解决方案