Results 1 to 1 of 1

Thread: VBScript SOAP

Threaded View

  1. #1
    Join Date
    Jul 2007
    Posts
    2
    Rep Power
    8

    Post VBScript SOAP

    Does anyone have a good example for sending a SOAP authentication request from a VBScript?

    Any help would be appreciated,

    Dan


    Iíve got it working, hereís the code if anyone needs it. hope it helps someone else.

    Code:
    Function ZimbraAuthentication()
    	'////Zimbra authentication function
    	Dim SOAPRes, Temp, SOAPMessage, AdminUserName, AdminPassword, http
    	Const SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS = 13056 
    	Const SoapServer = "https://Server:7071/service/admin/soap"
    	
    	'////Domain admin account on Zimbra server
    	AdminUserName = "Admin@zimbratest.mccneb.edu"
    	AdminPassword = "Password"
    	
    	'////Zimbra SOAP Authrequest
    	SOAPMessage  = "<soap:Envelope xmlns:soap="&chr(34)&"http://www.w3.org/2003/05/soap-envelope"&chr(34)&">" & _ 
    	                                "<soap:Header>" & _
    	                                       " <context xmlns="&chr(34)&"urn:zimbra"&chr(34)&">" & _	
    	                                       "<nosession/>" & _ 	
    										   "</context>" & _ 
    	                                "</soap:Header>" & _ 
    	                                "<soap:Body>" & _ 
    	                                        "<AuthRequest xmlns="&chr(34)&"urn:zimbraAdmin"&chr(34)&">" & _ 
    	                                                "<name> "& AdminUserName &"</name>" & _ 
    	                                                "<password>"& AdminPassword &"</password>" & _ 
    	                                        "</AuthRequest>" & _ 
    	                                "</soap:Body>" & _ 
    	                                "</soap:Envelope>"
    	                                
    	                                
    	                                                           
    	'////Start setting up the SOAP packet & Set it to ignore all cert errors (if self-signed cert)
    	Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
    	xmlhttp.setOption 2, SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
    	                                
    	xmlhttp.open "POST", SoapServer, False
    	xmlhttp.setRequestHeader "Man", POST & " " & SoapServer & " HTTP/1.1"
    	xmlhttp.setRequestHeader "MessageType", "CALL"
    	xmlhttp.setRequestHeader "Content-Type", "text/xml"
    	xmlhttp.send(SoapMessage)
    	
    	'////For Testing
    	WScript.Echo xmlhttp.status
    	WScript.Echo xmlhttp.statusText
    	WScript.Echo xmlhttp.responseText
    	
    	'////Get the authToken from the zimbra SOAP response to pass to other functions
    	SOAPRes = Split(xmlhttp.responseText, "<")
    	Temp = Split(SOAPRes(9), ">")
    	ZimbraAuthentication = Temp(1)
    	
    	
    End Function
    Last edited by dbrickman; 07-13-2007 at 10:30 AM.

Similar Threads

  1. XSD/WSDL Files for the SOAP Server?
    By photoadrian in forum Developers
    Replies: 5
    Last Post: 12-23-2012, 02:32 AM
  2. Jar For Soap Client
    By wcameron in forum Developers
    Replies: 19
    Last Post: 06-03-2009, 03:04 PM
  3. Question on SOAP compatibility
    By Robin Diederen in forum Developers
    Replies: 3
    Last Post: 09-19-2006, 02:26 AM
  4. Bug with preauth mechanism and SOAP headers?
    By Coilcore in forum Developers
    Replies: 3
    Last Post: 07-20-2006, 11:41 AM
  5. Soap Requests ...
    By ubumail in forum Developers
    Replies: 2
    Last Post: 04-26-2006, 07:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •