PEC inclusion of Caixa Economia

Asked

Viewed 131 times

-1

Good afternoon, I have the following problem.

The mistake :

soapenv:Serverthe Operation could not be found. The endpoint Reference (EPR) for the Operation not found is: 'https://des.barramento.caixa.gov.br:7081/Maintenance' and the Soapaction was 'https://des.barramento.caixa.gov.br/sibar/ManutencaoCobrancaBancaria/Boleto/Externo?wsdl/IncluirBoleto'org.apache.axis2.Axisfault: The Operation could not be found. The endpoint Reference (EPR) for the Operation not found is: 'https://des.barramento.caixa.gov.br:7081/Maintenance' and the Soapaction was 'https://des.barramento.caixa.gov.br/sibar/ManutencaoCobrancaBancaria/Boleto/Externo?wsdl/IncluirBoleto' at com.ibm.Broker.axis2.Axis2invoker.invokeAxis2(Axis2invoker.java:3123) at com.ibm.Broker.axis2.TomcatNodeRegistrationUtil.invokeAxis2(Tomcatnoderegistrationutil.java:664) at com.ibm.Broker.axis2.TomcatNodeRegistrationUtil.invokeAxis2(Tomcatnoderegistrationutil.java:610)

XML request

<?xml version="1.0" encoding="utf-8" ?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ext="https://caixa.gov.br/sibar/manutencao_cobranca_bancaria/boleto/externo"
xmlns:sib="https://caixa.gov.br/sibar">
  <soapenv:Header/>
  <soapenv:Body>
    <ext:SERVICO_ENTRADA>
      <sib:HEADER>
        <VERSAO>1.0</VERSAO>
        <AUTENTICACAO>Removido por questões de segurança</AUTENTICACAO>
        <USUARIO_SERVICO>Removido por questões de segurança</USUARIO_SERVICO>
        <OPERACAO>INCLUI_BOLETO</OPERACAO>
        <SISTEMA_ORIGEM>SIGCB</SISTEMA_ORIGEM>
        <UNIDADE>Removido por questões de segurança</UNIDADE>
        <DATA_HORA>20180829110000</DATA_HORA>
      </sib:HEADER>
      <DADOS>
        <INCLUI_BOLETO>
          <CODIGO_BENEFICIARIO>Removido por questões de segurança</CODIGO_BENEFICIARIO>
          <TITULO>
            <NOSSO_NUMERO>0</NOSSO_NUMERO>
            <NUMERO_DOCUMENTO>00000011</NUMERO_DOCUMENTO>
            <DATA_VENCIMENTO>2018-09-09</DATA_VENCIMENTO>
            <VALOR>1000.00</VALOR>
            <TIPO_ESPECIE>99</TIPO_ESPECIE>
            <FLAG_ACEITE>S</FLAG_ACEITE>
            <DATA_EMISSAO>2018-08-29</DATA_EMISSAO>
            <JUROS_MORA>
              <TIPO>TAXA_MENSAL</TIPO>
              <VALOR>2.00</VALOR>
            </JUROS_MORA>
            <VALOR_ABATIMENTO>100.00</VALOR_ABATIMENTO>
            <POS_VENCIMENTO>
              <ACAO>DEVOLVER</ACAO>
              <NUMERO_DIAS>999</NUMERO_DIAS>
            </POS_VENCIMENTO>
            <CODIGO_MOEDA>9</CODIGO_MOEDA>
            <PAGADOR>
              <CPF>22222222222</CPF>
              <NOME>TESTE PAGADOR 001</NOME>
              <ENDERECO>
                <LOGRADOURO>SAUS QUADRA 03</LOGRADOURO>
                <BAIRRO>BRASILIA</BAIRRO>
                <CIDADE>BRASILIA</CIDADE>
                <UF>DF</UF>
                <CEP>70070030</CEP>
              </ENDERECO>
            </PAGADOR>
            <MULTA>
              <DATA>2018-09-09</DATA>
              <VALOR>20.00</VALOR>
            </MULTA>
            <DESCONTOS>
              <!--1 to 3 repetitions:-->
              <DESCONTO>
                <DATA>2018-08-30</DATA>
                <!--You have a CHOICE of the next 2 items at this level-->
                <PERCENTUAL>10.00</PERCENTUAL>
              </DESCONTO>
              <DESCONTO>
                <DATA>2018-09-02</DATA>
                <!--You have a CHOICE of the next 2 items at this level-->
                <PERCENTUAL>5.00</PERCENTUAL>
              </DESCONTO>
              <DESCONTO>
                <DATA>2018-09-05</DATA>
                <!--You have a CHOICE of the next 2 items at this level-->
                <PERCENTUAL>3.00</PERCENTUAL>
              </DESCONTO>
            </DESCONTOS>
            <FICHA_COMPENSACAO>
              <MENSAGENS>
                <MENSAGEM>TESTE DE INCLUSAO WEBSERVICE 1</MENSAGEM>
                <MENSAGEM>TESTE DE INCLUSAO WEBSERVICE 2</MENSAGEM>
              </MENSAGENS>
            </FICHA_COMPENSACAO>
            <RECIBO_PAGADOR>
              <MENSAGENS>
                <MENSAGEM>TESTE DE INCLUSAO WS MSG PAG 1</MENSAGEM>
                <MENSAGEM>TESTE DE INCLUSAO WS MSG PAG 2</MENSAGEM>
                <MENSAGEM>TESTE DE INCLUSAO WS MSG PAG 3</MENSAGEM>
                <MENSAGEM>TESTE DE INCLUSAO WS MSG PAG 4</MENSAGEM>
              </MENSAGENS>
            </RECIBO_PAGADOR>
            <PAGAMENTO>
              <QUANTIDADE_PERMITIDA>1</QUANTIDADE_PERMITIDA>
              <TIPO>ACEITA_VALORES_ENTRE_MINIMO_MAXIMO</TIPO>
              <VALOR_MINIMO>500.00</VALOR_MINIMO>
              <VALOR_MAXIMO>1500.00</VALOR_MAXIMO>
            </PAGAMENTO>
          </TITULO>
        </INCLUI_BOLETO>
      </DADOS>
    </ext:SERVICO_ENTRADA>
  </soapenv:Body>
</soapenv:Envelope>

Call c#

string baseUrl = "https://des.barramento.caixa.gov.br/sibar/ManutencaoCobrancaBancaria/Boleto/Externo";

 var xlmParametros = File.ReadAllText(@"C:\ProvasDeConceito\Poc.PEC.Caixa\xml\IncluirBoletoRequestSoap.xml");
    HttpResponseMessage response = PostXmlRequest(baseUrl, "IncluirBoleto", xlmParametros).Result;


     public static async Task<HttpResponseMessage> PostXmlRequest(string baseUrl, string action, string xmlString)
            {
                using (var httpClient = new HttpClient())
                {
                    var httpContent = new StringContent(xmlString, Encoding.UTF8, "text/xml");
                    string actionFull = baseUrl + "/" + action;
                    httpContent.Headers.Add("SOAPAction", actionFull);

                    return await httpClient.PostAsync(baseUrl, httpContent);
                }
            }
  • 2

    I recommend not to put authentication data(tags: user, user service) in this public example, even if it is related to internal development environment.

  • Leandro, did my answer answer your question? If you have answered, please mark it as accepted by clicking on the visa sign ( ). But do this only if the answer has answered your original question. When you reach 15 reputation points you can also vote in favour of an answer or question. See: Someone answered me and Why vote?. Also do the [tour], for an initial explanation of how the site works.

1 answer

1


The mistake is saying that the SOAPAction that you used is not being found at this service. I took a look at the service’s WSDL, at:

https://des.barramento.caixa.gov.br/sibar/ManutencaoCobrancaBancaria/Boleto/Externo?wsdl

And I noticed that the soapAction really is wrong:

<wsdl:operation name="INCLUI_BOLETO">
  <soap:operation soapAction="IncluiBoleto"/>

See that the soapAction correct is only "Incluiboleto", and you are using "Incluiboleto" (with an extra "r" that does not exist in the name), and are still adding the contents of the variable baseUrl to the name, which is also wrong.

Change this section of:

   string actionFull = baseUrl + "/" + action;
   httpContent.Headers.Add("SOAPAction", actionFull);

for:

   httpContent.Headers.Add("SOAPAction", action);

And change the name of the action you are passing on the function call:

HttpResponseMessage response = PostXmlRequest(baseUrl,
                                              "IncluiBoleto",
                                              xlmParametros).Result;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.