I will be grateful for any help. I need to parse XML SOAP document but always I get the same result -> plain text without tags. How Can I get particular/single tag (f.e. vatNumber) value from XML ? Thank you.
This is my VBA code:
ObjHTTP.Open "Post", sURL, False
ObjHTTP.setRequestHeader "Content-Type", "text/xml"
ObjHTTP.send (sEnv)
'parse xml response - output
Dim responseDocument As MSXML2.DOMDocument60
Set responseDocument = New MSXML2.DOMDocument60
responseDocument.async = False
responseDocument.validateOnParse = False
responseDocument.SetProperty "SelectionNamespaces", " xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"
responseDocument.LoadXML (ObjHTTP.responseText)
If responseDocument.parseError.reason <> "" Then
MsgBox m_objDOMPeople.parseError.reason
Exit Sub
End If
MsgBox responseDocument.SelectNodes("/soap:Envelope/soap:Body")(0).Text
Set ObjHTTP = Nothing
Set xmldoc = Nothing
This is XML SOAP input:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<checkVatResponse xmlns="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
<countryCode>SK</countryCode>
<vatNumber>204566287588</vatNumber>
<requestDate>2015-04-07+01:00</requestDate>
<valid>true</valid>
<name>Company k. s.</name>
<address>Some Address</address>
</checkVatResponse>
</soap:Body>
</soap:Envelope>