public static BEWSConsultarCIPResponseMod1 ConsultarCIPsMod1(BEWSConsultarCIPRequestMod1 request) { BEWSConsultarCIPResponseMod1 response = new BEWSConsultarCIPResponseMod1(); using (var proxy = new WSCrypto()) { proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; proxy.Proxy = WebProxy.GetDefaultProxy(); proxy.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; request.CIPS = request.CIPS.Trim(); request.Firma = proxy.Signer(request.CIPS, ByteUtil.FileToByteArray(PrivatePath)); request.CIPS = proxy.EncryptText(request.CIPS, ByteUtil.FileToByteArray(PublicPathContraparte)); using (var proxyCIP = new Service()) { response = proxyCIP.ConsultarCIPMod1(request); if (response != null) { if (!String.IsNullOrEmpty(response.XML)) { response.XML = proxy.DecryptText(response.XML, ByteUtil.FileToByteArray(PrivatePath)); } } } } return(response); }
public static BEWSConsultarCIPResponseMod1 ConsultarCIP(BEWSConsultarCIPRequestMod1 request) { request.CodServ = ConfigurationManager.AppSettings["PE_MERCHAND_ID"]; BEWSConsultarCIPResponseMod1 response = new BEWSConsultarCIPResponseMod1(); try { using (var proxy = new WSCrypto()) { proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; proxy.Proxy = WebProxy.GetDefaultProxy(); proxy.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; request.CIPS = request.CIPS.Trim(); request.Firma = proxy.Signer(request.CIPS, ByteUtil.FileToByteArray(PrivateKey)); request.CIPS = proxy.EncryptText(request.CIPS, ByteUtil.FileToByteArray(PublicKey)); using (var proxyCIP = new Service()) { response = proxyCIP.ConsultarCIPMod1(request); if (response != null) { if (!String.IsNullOrEmpty(response.XML)) { response.XML = proxy.DecryptText(response.XML, ByteUtil.FileToByteArray(PrivateKey)); } } } } return(response); } catch (Exception ex) { response.Mensaje = ex.Message; response.Estado = "-1"; return(response); } }