(注意 mensaje xml 标签)
但是当我从soapUI或Postman调用这个服务时,答案是这样的: 它添加了一个 xmlsn="" 我需要删除它,但我不知道如何删除。这是我的代码:
' Load and extract data from the input XML
oXMLDocument.LoadXml(Input)
sConvenio = GetSetNodeValue(oXMLDocument, "mensaje/encabezado/convenio", "", Nothing)
siden01 = Trim(GetSetNodeValue(oXMLDocument, "mensaje/identificador/iden01", "", Nothing))
' Check the length of a string
If Strings.Len(ConectaCompania(sConvenio)) = 36 Then
' Construct a SOAP request
sTemp = "<!-- Query -->"
sQuery = "<!-- SOAP request construction code -->"
' Send the SOAP request and receive a response
sSOAPans = DISnode.Interact(sQuery)
oXMLDoc.LoadXml(sSOAPans)
' Process the SOAP response and set values in the response XML
If xmlNL.Count = 0 And oXMLDoc.InnerText <> "oRecordset0.00000000" Then
' Extract and set response tags
GetSetNodeValue(oXMLDocument, "mensaje/encabezado/codigoRetorno", "000", Nothing)
GetSetNodeValue(oXMLDocument, "mensaje/encabezado/mensajeRetorno", "CONSULTA EXITOSA", Nothing)
' Extract and set identifier and value tags (repeat for others)
GetSetNodeValue(oXMLDocument, "mensaje/identificador/iden01", siden01, Nothing)
' ...
' Return the modified XML document
Return oXMLDocument
End If
End If
如您所见,我没有添加 xmlns="" ,以便由肥皂响应添加。我怎样才能防止这种情况发生?谢谢!
我尝试返回 XNode 对象而不是 XmlDocument 并在标签内搜索 xmlns="" 并将其删除。没有任何结果。
ConsultarResponse
元素绑定到命名空间并且不使用命名空间前缀。任何没有命名空间前缀的后代元素都将位于http://sebagos.bi.com.gt/Consultar 命名空间中。因此,它需要
xmlns=""
来指示没有与
mensaje
元素(及其后代)关联的命名空间,并且它们不绑定到http://sebipagos.bi.com.gt/Consultar 命名空间。 如果您不想在
xmlns=""
元素上看到
mensaje
,那么您需要让
ConsultartResponse
使用命名空间前缀,或者不绑定到命名空间。