home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / WebSvc20938112142007.psc / clsSoap.cls < prev    next >
Text File  |  2007-12-10  |  2KB  |  59 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "clsSoap"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Option Explicit
  15. '|--------------------------------------------------|
  16. '| SOAP Authentication Header                       |
  17. '|--------------------------------------------------|
  18. Implements IHeaderHandler ' means this class is based on IHeaderHandler
  19.  
  20. ' local variables to store properties
  21. Private m_Username As String
  22. Private m_Password As String
  23.  
  24. ' the namespace which the service uses
  25. Public NameSpace As String
  26.  
  27. Public Sub SetLogin(Username As String, Password As String)
  28.     m_Username = Username
  29.     m_Password = Password
  30. End Sub
  31.  
  32. Private Sub iHeaderHandler_WriteHeaders(ByVal SoapSerializer As ISoapSerializer, ByVal obj As Object)
  33.     'write the Authentication header
  34.     With SoapSerializer
  35.         ' start a parent Authentication element
  36.         .StartHeaderElement "Authentication", NameSpace
  37.             ' containing a username element with the username
  38.             .StartElement "Username", NameSpace
  39.                 .WriteString m_Username
  40.             .EndElement
  41.             ' and a password element with the password
  42.             .StartElement "Password", NameSpace
  43.                 .WriteString m_Password
  44.             .EndElement
  45.         .EndHeaderElement
  46.     End With
  47. End Sub
  48.  
  49. 'some administration below
  50.  
  51. Private Function iHeaderHandler_ReadHeader(ByVal Reader As ISoapReader, ByVal HeaderNode As IXMLDOMNode, ByVal obj As Object) As Boolean
  52.     iHeaderHandler_ReadHeader = False
  53. End Function
  54.  
  55. Private Function iHeaderhandler_WillWriteHeaders() As Boolean
  56.     iHeaderhandler_WillWriteHeaders = True
  57. End Function
  58.  
  59.