Я отправляю запрос XML стороннему API и получаю ответ, который мне нужно проанализировать, чтобы получить сообщение об ошибке или идентификатор успеха и заказа.
Вот ответЯ получаю сообщение об ошибке.
<!--?xml version="1.0" encoding="UTF-8"?-->
<soap:envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:body>
<createbackgroundcheckresponse xmlns="https://www.website.com/sif/ws/hrxml/2.0">
<applicationacknowledgement>
<payloadresponsesummary>
<payloaddisposition>
<entitydisposition>
<entityinstancexpath>/Order/SearchPackage[1]/ReferenceId[1]/IdValue[1] </entityinstancexpath>
<entityexception>
<exception>
<exceptionidentifier>02x0033</exceptionidentifier>
<exceptionseverity>Fatal</exceptionseverity>
<exceptionmessage>An order is already being processed with the same user</exceptionmessage>
</exception>
</entityexception>
</entitydisposition>
</payloaddisposition>
</payloadresponsesummary></applicationacknowledgement>
</createbackgroundcheckresponse>
</soap:body>
</soap:envelope>
Я могу получить ответ и записать его в браузер, но не могу разобрать его.Вот что у меня есть, когда я отправляю его.
Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlHttp.Open "POST", xUrl, False 'False = Synckronous Process
xmlHttp.SetRequestHeader "Content-type", contentType
xmlHttp.SetRequestHeader "Content-Length", Len(xmlBody)
xmlHttp.SetOption 2, 13056 'Ignore SSL errors
xmlHttp.Send xmlBody
'Get the response back
sRet = xmlHttp.ResponseText
If xmlHttp.ReadyState = 4 And xmlHttp.Status = 200 Then
HttpPOST = sRet
Else
HttpPOST = "[Http-Failure] " & vbNewLine & sRet
End If
Как только я получу данные обратно, вот что у меня есть.1012 *.Тогда он пройдет первую проверку If Not (xmlNodeList is Nothing) Then
.Но тогда его длина равна 0, поэтому он не может пройти эту часть.