TFS_ANTIGUO/PrendarioDavivienda/ULA.Davivienda.WCFServiciosCobisCartera/ULA.Davivienda.WCFServiciosCobisCartera.BL/TasaEscalonada.vb

119 lines
5.4 KiB
VB.net
Raw Permalink Normal View History

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("<ns13:CrearTasaEscalonadaResponse xmlns='http://dto2.commons.ecobis.cobiscorp' xmlns:ns2='http://dto.garantia.activacion.ultimus.ecobis.cobiscorp' xmlns:ns3='http://dto2.sdf.cts.cobis.cobiscorp.com' xmlns:ns4='http://dto.desembolso.ultimus.ecobis.cobiscorp' xmlns:ns5='http://dto.seguro.creacion.ultimus.ecobis.cobiscorp' xmlns:ns6='http://dto.operacion.actualizacion.ultimus.ecobis.cobiscorp' xmlns:ns7='http://dto.liquidacion.ultimus.ecobis.cobiscorp' xmlns:ns8='http://dto.garantia.creacion.ultimus.ecobis.cobiscorp' xmlns:ns9='http://dto.beneficiario.ultimus.ecobis.cobiscorp' xmlns:ns10='http://dto.operaciones.anulacion.ultimus.ecobis.cobiscorp' xmlns:ns11='http://dto.operacion.creacion.ultimus.ecobis.cobiscorp' xmlns:ns12='http://dto.codeudor.ultimus.ecobis.cobiscorp' xmlns:ns13='http://service.ultimus.ecobis.cobiscorp' xmlns:ns14='http://dto.tasaescalona.ultimus.ecobis.cobiscorp' xmlns:ns15='http://dto.liquidacionprendario.ultimus.ecobis.cobiscorp'><ns13:outTasaEscalonadaOut><ns3:success>true</ns3:success><ns14:estadoProceso>S</ns14:estadoProceso><ns14:codigoError>0</ns14:codigoError><ns14:descripcionError></ns14:descripcionError></ns13:outTasaEscalonadaOut></ns13:CrearTasaEscalonadaResponse>")
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