Soap Type Library v3.0

Microsoft Office Soap Type Library v3.0

Not installed on Windows 7, 8 or 10

microsoft excel docs

Microsoft Soap Library

This is the previous version (2.0) of this library

Sub test() 
Dim doc As DOMDocument60
Dim req As XMLHTTP
Dim node As IXMLDOMElement
Dim root As Object
Dim response As DOMDocument
    Set doc = New DOMDocument60
    Set root = doc.createProcessingInstruction("xml", "version='1.0' encoding='UTF-8'")
    doc.appendChild root
    Set node = doc.appendChild(doc.createElement("soap:Envelope"))
    With node
        .setAttribute "xmlns:xsi", ""
        .setAttribute "xmlns:xsd", ""
        .setAttribute "xmlns:soap", ""
        With .appendChild(doc.createElement("soap:Body"))
            Set node = .appendChild(doc.createElement("GetQuote"))
            node.setAttribute "xmlns", "http://www.webserviceX.NET/"
            node.appendChild(doc.createNode(NODE_ELEMENT, "symbol", "http://www.webserviceX.NET/")).Text = "GOOG"
        End With
    End With
    Set req = New XMLHTTP
    req.Open "POST", "", False
    req.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
    req.setRequestHeader "SOAPAction", "http://www.webserviceX.NET/GetQuote"
    req.setRequestHeader "Content-Length", Len(doc.XML)
    req.send doc.XML
    Set response = New DOMDocument
    response.LoadXML (req.responseText)
    response.LoadXML response.SelectSingleNode("//GetQuoteResult").Text
    Debug.Print response.SelectSingleNode("//Name").Text, _
       response.SelectSingleNode("//Date").Text, response.SelectSingleNode("//High").Text
End Sub

Sub POSTExample()
Dim request As XMLHTTP
Dim myValue As String
Dim doc As DOMDocument60
    myValue = Range("Request")
    Set request = New XMLHTTP
    Set doc = New DOMDocument60
    With request
        .Open "POST", "<MY ENDPOINT ADDRESS HERE>", False
        .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
        .send myValue
        doc.LoadXML (.responseText)
    End With

    Debug.Print doc.Text
End Sub

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext