[Learning diary] verifies the information added to the SOAP header to authenticate the request WEB service.

Source: Internet
Author: User
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
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.