First of all, of course, it is the method for adding information in the sent SOAP header. There have been records before, so I will not write them here.
See
[Learning diary] how to add content to the SOAP request header
The information added to the header this time is: dim proxy as GetHttpHeadersProxy = new GetHttpHeadersProxy
Proxy. AddHttpHeader ("name", "aowind ")
Proxy. AddHttpHeader ("pwd", "123456 ")
The next step is the WEB service verification method. <% @ WebService Language = "vb" Class = "believing. Believing" %>
Imports System
Imports System. Web. Services
Imports System. IO
Imports System. Collections
Public Structure httpheaderStructure httpheader
Public name As String
Public value As String
End Structure
<System. Web. Services. WebService (Namespace: = "http://hx66.com", Description: = "authentication service")> _
Public Class BelievingClass Believing
Inherits System. Web. Services. WebService
<WebMethod (Description: = "<font color = green> authentication method </font>")> _
Public Function lianzheng () As String
Dim name, pwd as string
Name = Context. Request. Headers ("name ")
Pwd = Context. Request. Headers ("pwd ")
If (name exists in the User table) And (pwd exists in the User table) Then
Try
.
Catch ex As Exception
Return ex. ToString
End Try
Return "OK! "
Else
Return "the user name or password is incorrect and the request is not processed"
End If
End Function
We can see that
Name = Context. Request. Headers ("name ")
Pwd = Context. Request. Headers ("pwd ")
The two statements are used to retrieve data from the SOAP header.
You can also use the index method to obtain
Context. Request. Headers (0). value