private RetornoIntegracaoNegocios AtualizarNegocios(ParametroIntegracaoPessoa param, string xml) { _log.TraceMethodStart(); CucCluParametro parametrosLogin = GerarParametroCUC(param); ConfiguracaoURICUC configuracaoURICUC = ConfiguracaoCUCService.BuscarURI(ConstantesInegracao.URLConfiguracao.CadastroNegocios, _configuracaoCUC); EndpointAddress address = new EndpointAddress(configuracaoURICUC.URI); CucClwCadastroNegocioOutrosBancosClient client = new CucClwCadastroNegocioOutrosBancosClient(CucClwCadastroNegocioOutrosBancosClient.EndpointConfiguration.BasicHttpBinding_ICucClwCadastroNegocioOutrosBancos, address); try { _log.Trace($"Chamando o método CUC: {configuracaoURICUC.URI}"); var ret = client.Atualizar(parametrosLogin, xml); _log.Trace($"Finalização da chamada do método CUC: {configuracaoURICUC.URI} "); RetornoIntegracaoNegocios retorno = GerarRetornoIntegracaoNegocios(ret); _log.TraceMethodEnd(); return(retorno); } catch (TimeoutException timeoutEx) { client.Abort(); throw new Exception("Tempo de conexão expirado", timeoutEx); } catch (EndpointNotFoundException endPointEx) { throw new Exception("Caminho do serviço não disponível ou inválido", endPointEx); } }
private RetornoIntegracaoNegocios GerarRetornoIntegracaoNegocios(CucCluRetorno paramRetorno) { _log.TraceMethodStart(); RetornoIntegracaoNegocios retorno = new RetornoIntegracaoNegocios(); retorno.CodigoFilial = paramRetorno.CodigoFilial; retorno.CodigoPessoa = paramRetorno.CodigoPessoa; retorno.CodigoContaRelacionamento = paramRetorno.CodigoContaRelacionamento; retorno.TipoPessoa = paramRetorno.TipoPessoa; retorno.Excecao = paramRetorno.Excecao; retorno.Xml = paramRetorno.Xml; _log.TraceMethodEnd(); return(retorno); }
public DataSetNegocioOutrosBancos SelecionarNegocios(ParametroIntegracaoPessoa param, string cod_pessoa, string cod_filial = null) { _log.TraceMethodStart(); CucCluParametro parametrosLogin = GerarParametroCUC(param); ConfiguracaoURICUC configuracaoURICUC = ConfiguracaoCUCService.BuscarURI(ConstantesInegracao.URLConfiguracao.CadastroNegocios, _configuracaoCUC); EndpointAddress address = new EndpointAddress(configuracaoURICUC.URI); CucClwCadastroNegocioOutrosBancosClient client = new CucClwCadastroNegocioOutrosBancosClient(CucClwCadastroNegocioOutrosBancosClient.EndpointConfiguration.BasicHttpBinding_ICucClwCadastroNegocioOutrosBancos, address); try { var ret = client.Selecionar(parametrosLogin, cod_pessoa, cod_filial); RetornoIntegracaoNegocios retorno = GerarRetornoIntegracaoNegocios(ret); if (retorno.Excecao != null) { throw new ApplicationException($"Retorno serviço CUC - {ret.Excecao.Mensagem}"); } if (string.IsNullOrWhiteSpace(retorno.Xml)) { throw new ApplicationException("Dados não encontrados para os parâmetros informados"); } XmlSerializer xmlSerialize = new XmlSerializer(typeof(DataSetNegocioOutrosBancos)); var valor_serealizado = new StringReader(retorno.Xml); DataSetNegocioOutrosBancos dataSetNegocios = (DataSetNegocioOutrosBancos)xmlSerialize.Deserialize(valor_serealizado); _log.TraceMethodEnd(); return(dataSetNegocios); } catch (TimeoutException timeoutEx) { client.Abort(); throw new Exception("Tempo de conexão expirado", timeoutEx); } catch (EndpointNotFoundException endPointEx) { throw new Exception("Caminho do serviço não disponível ou inválido", endPointEx); } }