Imports System.Web Imports ULA.Davivienda.WCFServiciosCobisCartera.DAL Imports ULA.Davivienda.WCFServiciosCobisCartera.Entidades Public Class TasaEscalonada Public gProceso As String = String.Empty Public gHttpServer As HttpServerUtility = Nothing Public Shared arrPrefix As String() = New String() {} Public Sub New(ByVal Proceso As String, ByRef httpServer As HttpServerUtility) gProceso = Proceso gHttpServer = httpServer End Sub Public Shared Function RegistrarTasaEscalonadas(req As RegistrarTasaEscalonadaRequest) As RegistrarTasaEscalonadaResponse Dim resp As RegistrarTasaEscalonadaResponse = Nothing Dim respXML As MSXML2.DOMDocument = New MSXML2.DOMDocument() Dim node As MSXML2.IXMLDOMNode = Nothing Dim xmNodeMessages As MSXML2.IXMLDOMNode = Nothing Dim strCode As String = "0" Dim strType As String = "0" Dim strError As String = String.Empty Dim strSuccess As String = String.Empty Dim strMessage As String = String.Empty Dim bIsDummie As Boolean = False Try resp = New RegistrarTasaEscalonadaResponse() respXML.async = False respXML.preserveWhiteSpace = True respXML.validateOnParse = False bIsDummie = System.Configuration.ConfigurationManager.AppSettings("isDummie") If (bIsDummie) Then Dim dummyXmlDoc As MSXML2.DOMDocument = New MSXML2.DOMDocument() dummyXmlDoc.loadXML("trueS0") arrPrefix = outSoapConector.ObtienePrefijosNameSpace(dummyXmlDoc, "WS_COBIS_11") respXML = dummyXmlDoc strError = String.Empty Else respXML = outSoapConector.InvocaWebServiceSoap(req.strXML, strError, arrPrefix, req.Proceso, req.Usuario) End If If (strError.Trim().Length > 0) Then Throw New Exception(strError) End If node = respXML.childNodes(0).childNodes(0) '*************************************************************************************** 'Valida estructura de control de errores '*************************************************************************************** If (Not IsNothing(node.selectSingleNode(arrPrefix(2) & ":success"))) Then strSuccess = node.selectSingleNode(arrPrefix(2) & ":success").text If (strSuccess.Trim().ToLower() = "false") Then If (Not IsNothing(node.selectSingleNode(arrPrefix(2) & ":messages"))) Then xmNodeMessages = node.selectSingleNode(arrPrefix(2) & ":messages") strCode = xmNodeMessages.selectSingleNode("code").text strMessage = xmNodeMessages.selectSingleNode("message").text End If Throw New Exception("Error: Code:" & strCode & " - Message:" & strMessage & " - Type:" & strType) End If End If '*************************************** 'Valida tags de control de Errores '*************************************** If node.selectSingleNode(arrPrefix(20) & ":estadoProceso") Is Nothing Then Throw New Exception("No se encontro la variable de salida: " & arrPrefix(20) & ":estadoProceso") End If If (node.selectSingleNode(arrPrefix(20) & ":estadoProceso").text.Trim() = "N") Then strCode = node.selectSingleNode(arrPrefix(20) & ":codigoError").text strMessage = node.selectSingleNode(arrPrefix(20) & ":descripcionError").text Throw New Exception("Error: Code:" & strCode & " - Message:" & strMessage) End If '*************************************** 'Estado Proceso '*************************************** resp.resultado = node.selectSingleNode(arrPrefix(20) & ":estadoProceso").text resp.errCode = "00" resp.errMessage = "EXITOSO" Catch ex As Exception resp.errCode = "99" resp.errMessage = ex.Message End Try Return resp End Function End Class