hi,
I try to browse a SOAP XML return, to extract the result, but after hours of testing I admit defeat.
I can't find the right methodology to access the different nodes, do you have any leads?
Thank you, Have a good day
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns1:IdentificationResponse xmlns:ns1="urn:Blurbe">
<IdentificationResult>
<e>
<r>
<agence>0001</agence>
<client blocage="N" groupement="3">0012</client>
<nom_soc>CLIENT DIVERS</nom_soc>
</r>
</e>
</IdentificationResult>
</ns1:IdentificationResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Private Function XmlDatasReader_Identification(pStr As String) As String
Dim output As String = ""
Try
Dim xmlDoc As New XmlDocument()
xmlDoc.LoadXml(pStr)
Dim nsManager = New XmlNamespaceManager(xmlDoc.NameTable)
nsManager.AddNamespace("ns1", "urn:Blurbe")
nsManager.AddNamespace("xsd", "http://www.w3.org/2001/XMLSchema")
nsManager.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance")
nsManager.AddNamespace("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/")
Dim nodes As XmlNodeList = xmlDoc.SelectNodes("//SOAP-ENV:Envelope/SOAP-ENV:Header/SOAP-ENV:Body/ns1:IdentificationResponse/IdentificationResult/e/r/", nsManager)
Dim agence As String = "", client As String = "", nom_soc As String = ""
' ///////////////////////////////
For Each node As XmlNode In nodes
If (node.SelectSingleNode("ns1:agence", nsManager) IsNot Nothing) Then agence = node.SelectSingleNode("ns1:agence", nsManager).InnerText
If (node.SelectSingleNode("ns1:client", nsManager) IsNot Nothing) Then client = node.SelectSingleNode("ns1:client", nsManager).InnerText
If (node.SelectSingleNode("ns1:nom_soc", nsManager) IsNot Nothing) Then nom_soc = node.SelectSingleNode("ns1:nom_soc", nsManager).InnerText
output &= "agence : " & agence & " / " & "client : " & client & " / " & "nom_soc : " & nom_soc
output &= "<br/>"
Next
' ///////////////////////////////
' If output = "" Then output = "OuterXml : " & xmlDoc.OuterXml
Catch ex As Exception
output = ex.ToString
End Try
Return output
End Function