Emissao da NFSE salvador ba

Boa tarde pessaol,
estou tendo os primeiro contatos com a emissao do nfse via soap/xml para bahia construi o xml segundo o modelo dele mais nao consigo comunicar de jeito nenhum vemo erro 415 na resposta ao enviar o LoteRPS

modelo que estou a seguir a baixo:

<?xml version="1.0" encoding="utf-8"?>
<EnviarLoteRpsEnvio xmlns="http://www.abrasf.org.br/ABRASF/arquivos/nfse.xsd">
    <LoteRps id="002">
        <NumeroLote>2</NumeroLote>
        <Cnpj>90790164000152</Cnpj>
        <InscricaoMunicipal>90790100178</InscricaoMunicipal>
        <QuantidadeRps>1</QuantidadeRps>
        <ListaRps>
            <Rps>
                <InfRps id="001">
                    <IdentificacaoRps>
                        <Numero>1</Numero>
                        <Serie>A</Serie>
                        <Tipo>1</Tipo>
                    </IdentificacaoRps>
                    <DataEmissao>2009-04-03T17:12:27</DataEmissao>
                    <NaturezaOperacao>5</NaturezaOperacao>
                    <OptanteSimplesNacional>2</OptanteSimplesNacional>
                    <IncentivadorCultural>2</IncentivadorCultural>
                    <Status>1</Status>
                    <Servico>
                        <Valores>
                            <ValorServicos>10000</ValorServicos>
                            <ValorDeducoes>0</ValorDeducoes>
                            <ValorPis>0</ValorPis>
                            <ValorCofins>0</ValorCofins>
                            <ValorIr>0</ValorIr>
                            <ValorCsll>0</ValorCsll>
                            <IssRetido>2</IssRetido>
                            <ValorIss>500</ValorIss>
                            <ValorIssRetido>0</ValorIssRetido>
                            <OutrasRetencoes>0</OutrasRetencoes>
                            <BaseCalculo>10000</BaseCalculo>
                            <Aliquota>0.05</Aliquota>
                            <ValorLiquidoNfse>10000</ValorLiquidoNfse>
                            <DescontoIncondicionado>0</DescontoIncondicionado>
                            <DescontoCondicionado>0</DescontoCondicionado>
                        </Valores>
                        <ItemListaServico>10.10</ItemListaServico>
                        <CodigoTributacaoMunicipio>Codigo Tributario</CodigoTributacaoMunicipio>
                        <Discriminacao>Teste emissão de nota</Discriminacao>
                        <CodigoMunicipio>2927408</CodigoMunicipio>
                    </Servico>
                    <Prestador>
                        <Cnpj>90790164000132</Cnpj>
                        <InscricaoMunicipal>90790100188</InscricaoMunicipal>
                    </Prestador>
                    <Tomador>
                        <IdentificacaoTomador>
                            <CpfCnpj>
                                <Cnpj>19562042000105</Cnpj>
                            </CpfCnpj>
                        </IdentificacaoTomador>
                        <RazaoSocial>Testes Tomador</RazaoSocial>
                        <Endereco>
                            <Endereco>Rua dos testes</Endereco>
                            <Numero>01</Numero>
                            <Bairro>COMERCIO</Bairro>
                            <CodigoMunicipio>2927408</CodigoMunicipio>
                            <Uf>BA</Uf>
                            <Cep>40015050</Cep>
                        </Endereco>
                    </Tomador>
                </InfRps>
                <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
                    <SignedInfo>
                        <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
                        <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
                        <Reference URI="#001">
                            <Transforms>
                                <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
                            </Transforms>
                            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
                            <DigestValue>pcAtmvGlJ+NIkSAxRc9fHGCRjWk=</DigestValue>
                        </Reference>
                    </SignedInfo>
                    <SignatureValue>n+ylb+Zs24LT0PKqt87rhRWJDbAMgraSZUvsUn06jOkNWGTicnZK9amKMntT1+LiMe+Cv/fXQvmJG/4EYbhw2CX012OvQ04FUcFpa7kxKg2qw009ec6BCNmDlJ4xYfzAyF+ffiGFGNrl5J6nJAAHFft4opaXy8LN5/2Nz67MVLk=</SignatureValue>
                    <KeyInfo>
                        <X509Data>
                            <X509SubjectName>[email protected], CN=Equipe de Desenvolvimento NFS-e, OU=Coordenadoria de Planejamento de Sistemas (CPS), O=Secretaria Municipal da Fazenda (Sefaz), L=Salvador, S=Bahia, C=BR</X509SubjectName>
                            <X509Certificate>MIIF9zCCBN+gAwIBAgIKEgkHZQAAAAAANDANBgkqhk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NlcyxDTj1TZXJ2aWNlcyxDTj1Db25maWd1cmF0aW9uLERDPWNwcyxEQz1uZXQ/Y2VydGlmaWNhdGVSZXZvY2F0aW9uTGlzdD9iYXNlP29iamVjdENsYXNzPWNSTERpc3RyaWJ1dGlvblBvaW50hjFodHRwOi8vaW1idWkuY3BzLm5ldC9DZXJ0RW5yb2xsL2ltYnVpLmNwcy5uZXQuY3JsMIIBCAYIKwYBBQUHAQEEgfswgfgwgagGCCsGAQUFBzAChoGbbGRhcDovLy9DTj1pbWJ1aS5jcHMubmV0LENOPUFJQSxDTj1QdWJsaWMlMjBLZXklMjBTZXJ2aWNlcyxDTj1TZXJ2aWNlcyxDTj1Db25maWd1cmF0aW9uLERDPWNwcyxEQz1uZXQ/Y0FDZXJ0aWZpY2F0ZT9iYXNlP29iamVjdENsYXNzPWNlcnRpZmljYXRpb25BdXRob3JpdHkwSwYIKwYBBQUHMAKGP2h0dHA6Ly9pbWJ1aS5jcHMubmV0L0NlcnRFbnJvbGwvaW1idWkuY3BzLm5ldF9pbWJ1aS5jcHMubmV0LmNydDANBgkqhkiG9w0BAQUFAAOCAQEAq2lENMSPZPZo0lz57XtbUyDqAdj+MV9FbFa1+gIu8JrxVsz1pThAEMpBkFyJmWPv26wkRL3x696a4psk4snEm965IOpdHuN+U+tH9vR0U0J1W4KASDJhyHDLFLDRrsMtyK3i1oBSdsmVnNtE2xMPxAFpS8qJH73Qls0iZYYV5VWYjrW2hNsg9rBO5PdiCbvgAbSEXv5dP4JZpc+D9kAffkb3VlgtilIOEpMEMrz+Y8u9Fc9AJP9d7mVuA/sAClhx5TeI6VuIt4DFZwt3c20MNrVLIG1qyt4Q8HcioO/cP98dXHel6ck6JutSWi19XVNqWiVkfOZsKTHfSzf5LpWLaQ==</X509Certificate>
                        </X509Data>
                        <KeyValue>
                            <RSAKeyValue>
                                <Modulus>sOmqCciqMErHi2wyjbiqnbIqhunNdNrZBX563PRQbbDbYYACejgmjjLxGANjEElA9WVeYcVfAFIsdaXlRn/IbasNfqXST0cJ0qK4pXXK3ntbB/EprqynO7/i7SJdl1eP/f4MPOF3KJj2gdiVjDMugHubDY19fDhEyiN3APUf09k=</Modulus>
                                <Exponent>AQAB</Exponent>
                            </RSAKeyValue>
                        </KeyValue>
                    </KeyInfo>
                </Signature>
            </Rps>
        </ListaRps>
    </LoteRps>
    <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
        <SignedInfo>
            <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
            <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
            <Reference URI="#002">
                <Transforms>
                    <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
                </Transforms>
                <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
                <DigestValue>fOXsrWEuDB1Zpg1aGfes20H5l0Q=</DigestValue>
            </Reference>
        </SignedInfo>
        <SignatureValue>c6E8E9ZJwC6/0kqSxoOwOro4kXmQutfDxWLexyGNAdJUKcNeCZIFmLISmMCcfPpexy8EdavvAeLRnP+aG3r/t92JRq3YnILFj7Ls3z6MBNAfLBTKAC3O0FzHqB8yEaRQMtJmh7nw1g9v3iJauJDfaSvVbWonC6LvlQ6EBxU72QY=</SignatureValue>
        <KeyInfo>
            <X509Data>
                <X509SubjectName>[email protected], CN=Equipe de Desenvolvimento NFS-e, OU=Coordenadoria de Planejamento de Sistemas (CPS), O=Secretaria Municipal da Fazenda (Sefaz), L=Salvador, S=Bahia, C=BR</X509SubjectName>
                <X509Certificate>MIIF9zCCBN+gAwIBAgIKEgkHZQAAAAAANDANBgkqhkiG9w0BAQUFADBCMRMwEQYKCZImiZPyLGQBGRYDbmV0MRMwEQYKCZImiZPyLGQBGRYDY3BzMRYwFAYDVQQDEw1pbWJ1aS5jcHMubmV0MB4XDTA5MDgyMTE3MTAxNloXDTEwMDgyMTE3MjAxNlowgfwxCzAJBgNVBAYTAkJSMQ4wDAYDVQQI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0RW5yb2xsL2ltYnVpLmNwcy5uZXQuY3JsMIIBCAYIKwYBBQUHAQEEgfswgfgwgagGCCsGAQUFBzAChoGbbGRhcDovLy9DTj1pbWJ1aS5jcHMubmV0LENOPUFJQSxDTj1QdWJsaWMlMjBLZXklMjBTZXJ2aWNlcyxDTj1TZXJ2aWNlcyxDTj1Db25maWd1cmF0aW9uLERDPWNwcyxEQz1uZXQ/Y0FDZXJ0aWZpY2F0ZT9iYXNlP29iamVjdENsYXNzPWNlcnRpZmljYXRpb25BdXRob3JpdHkwSwYIKwYBBQUHMAKGP2h0dHA6Ly9pbWJ1aS5jcHMubmV0L0NlcnRFbnJvbGwvaW1idWkuY3BzLm5ldF9pbWJ1aS5jcHMubmV0LmNydDANBgkqhkiG9w0BAQUFAAOCAQEAq2lENMSPZPZo0lz57XtbUyDqAdj+MV9FbFa1+gIu8JrxVsz1pThAEMpBkFyJmWPv26wkRL3x696a4psk4snEm965IOpdHuN+U+tH9vR0U0J1W4KASDJhyHDLFLDRrsMtyK3i1oBSdsmVnNtE2xMPxAFpS8qJH73Qls0iZYYV5VWYjrW2hNsg9rBO5PdiCbvgAbSEXv5dP4JZpc+D9kAffkb3VlgtilIOEpMEMrz+Y8u9Fc9AJP9d7mVuA/sAClhx5TeI6VuIt4DFZwt3c20MNrVLIG1qyt4Q8HcioO/cP98dXHel6ck6JutSWi19XVNqWiVkfOZsKTHfSzf5LpWLaQ==</X509Certificate>
            </X509Data>
            <KeyValue>
                <RSAKeyValue>
                    <Modulus>sOmqCciqMErHi2wyjbiqnbIqhunNdNrZBX563PRQbbDbYYACejgmjjLxGANjEElA9WVeYcVfAFIsdaXlRn/IbasNfqXST0cJ0qK4pXXK3ntbB/EprqynO7/i7SJdl1eP/f4MPOF3KJj2gdiVjDMugHubDY19fDhEyiN3APUf09k=</Modulus>
                    <Exponent>AQAB</Exponent>
                </RSAKeyValue>
            </KeyValue>
        </KeyInfo>
    </Signature>
</EnviarLoteRpsEnvio>

preciso de ajudar pessoal.

Pessoal boa tarde algem me ajuda. ao enviar o xml para consumir webserver da perfeitura do salvador ve esta erro.
"
HTTP/1.1 415 Cannot process the message because the content type ‘text/xml;charset=ISO-8859-1;’ was not the expected type ‘text/xml; charset=utf-8’. "

Qual é a linguagem de programação que você está usando?

Pela mensagem de erro, você precisa mudar para UTF-8.

Segue o exemplo em PHP:

    public function sendRequest(string $envelope, string $action, string $url): array
    {
        
        $headers = array(
            "Content-type: text/xml;charset=UTF-8",
            "Accept-Encoding: gzip,deflate",
            "SOAPAction: \"$action\"",
            "Content-length: " . strlen($envelope),
        );
        
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_TIMEOUT, 300);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $envelope);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_ENCODING, "identity, deflate, gzip");
        
        //Usar proxy se a prefeitura bloquear IPs estrangeiros
        //$proxy = '200.255.122.174:8080';
        //curl_setopt($ch, CURLOPT_PROXY, $proxy);
        //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        
        $html = curl_exec($ch);
        $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
        
        return [
            "html" => $html,
            "code" => $httpcode
        ];
        
    }

Bom dia Luiz. Muito obrigado, estou usar o PHP dentro da scriptcase. Vou implementar aqui. ja ja te dou um feedback.

1 curtida

Este tópico foi fechado automaticamente 30 dias depois da última resposta. Novas respostas não são mais permitidas.