Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Visual Basic 6.0 Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(Visual Basic 6.0) SOAP WS-Security Username Authentication

Demonstrates creating SOAP XML for WS-Security Username Authentication. The client user name and password are encapsulated in a WS-Security <wsse:UsernameToken>.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

' Generate this XML with the code that follows:

' 	<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
' 	 <soap:Header>	     
' 	  <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext">
' 	   <wsse:UsernameToken wsu:Id="sample" 
' 	       xmlns:wsu="http://schemas.xmlsoap.org/ws/2003/06/utility">
' 	    <wsse:Username>sample</wsse:Username>
' 	    <wsse:Password Type="wsse:PasswordText">oracle</wsse:Password>
' 	    <wsu:Created>2004-05-19T08:44:51Z</wsu:Created>
' 	   </wsse:UsernameToken>
' 	  </wsse:Security>
' 	  <wsse:Security soap:actor="oracle" 
' 	      xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext">
' 	   <wsse:UsernameToken wsu:Id="oracle" 
' 	       xmlns:wsu="http://schemas.xmlsoap.org/ws/2003/06/utility">
' 	    <wsse:Username>myUsername</wsse:Username>
' 	    <wsse:Password Type="wsse:PasswordText">myPassword</wsse:Password>
' 	    <wsu:Created>2004-05-19T08:46:04Z</wsu:Created>
' 	   </wsse:UsernameToken>
' 	  </wsse:Security>
' 	 </soap:Header>
' 	  <soap:Body>
' 	   <getHello xmlns="http://www.oracle.com"/>
' 	  </soap:Body>
' 	</soap:Envelope>
' 

' First build the outer housing:
Dim xml As New ChilkatXml
xml.Tag = "soap:Envelope"
success = xml.AddAttribute("xmlns:soap","http://schemas.xmlsoap.org/soap/envelope/")
xml.UpdateChildContent "soap:Header",""
success = xml.UpdateAttrAt("soap:Body|getHello",1,"xmlns","http://www.oracle.com")

' Get the current date/time in a string with this format: 2004-05-19T08:46:04Z
Dim dt As New CkDateTime
success = dt.SetFromCurrentSystemTime()
Dim bLocal As Long
bLocal = 0
Dim created As String
created = dt.GetAsTimestamp(bLocal)

' Now build each UsernameToken block:
Dim wsse1 As New ChilkatXml
wsse1.Tag = "wsse:Security"
success = wsse1.AddAttribute("xmlns:wsse","http://schemas.xmlsoap.org/ws/2003/06/secext")
success = wsse1.UpdateAttrAt("wsse:UsernameToken",1,"wsu:Id","sample")
success = wsse1.UpdateAttrAt("wsse:UsernameToken",1,"xmlns:wsu","http://schemas.xmlsoap.org/ws/2003/06/utility")
wsse1.UpdateChildContent "wsse:UsernameToken|wsse:Username","sample"
success = wsse1.UpdateAttrAt("wsse:UsernameToken|wsse:Password",1,"Type","wsse:PasswordText")
wsse1.UpdateChildContent "wsse:UsernameToken|wsse:Password","oracle"
wsse1.UpdateChildContent "wsse:UsernameToken|wsu:Created",created

Dim wsse2 As New ChilkatXml
wsse2.Tag = "wsse:Security"
success = wsse2.AddAttribute("soap:actor","oracle")
success = wsse2.AddAttribute("xmlns:wsse","http://schemas.xmlsoap.org/ws/2003/06/secext")
success = wsse2.UpdateAttrAt("wsse:UsernameToken",1,"wsu:Id","oracle")
success = wsse2.UpdateAttrAt("wsse:UsernameToken",1,"xmlns:wsu","http://schemas.xmlsoap.org/ws/2003/06/utility")
wsse2.UpdateChildContent "wsse:UsernameToken|wsse:Username","oracle"
success = wsse2.UpdateAttrAt("wsse:UsernameToken|wsse:Password",1,"Type","wsse:PasswordText")
wsse2.UpdateChildContent "wsse:UsernameToken|wsse:Password","oracle"
wsse2.UpdateChildContent "wsse:UsernameToken|wsu:Created",created

' Insert the UsernameToken blocks:
Dim xHeader As ChilkatXml
Set xHeader = xml.GetChildWithTag("soap:Header")
success = xHeader.AddChildTree(wsse1)
success = xHeader.AddChildTree(wsse2)

' Show the XML:
Debug.Print xml.GetXml()

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.