NFS Integration and São Paulo City Hall returns Bad Request

0

I'm developing a PHP system to generate NFSe that uses the Web Service of the city of São Paulo, but I'm not able to integrate with the Web Service. Whenever I send an XML message to the Web Service, I get a response with the following information:

HTTP/1.1 400 Bad Request
Cache-Control: private
Content-Type: application/soap+xml; charset=utf-8
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 21 Jun 2018 13:25:20 GMT
Content-Length: 0

To make the test request, I'm using SoapUI 5.2.1.

Example of request "QueryCNPJ" that is giving error:

<?xml version="1.0" encoding="UTF-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <ConsultaCNPJRequest xmlns="http://www.prefeitura.sp.gov.br/nfe">
      <VersaoSchema>1</VersaoSchema>
      <MensagemXML>
          <PedidoConsultaCNPJ>
              <Cabecalho Versao="1">
                <CPFCNPJRemetente>
                  <CNPJ>CNPJ x</CNPJ>
                </CPFCNPJRemetente>
              </Cabecalho>
            <CNPJContribuinte>
            <CNPJ>CNPJ Y</CNPJ>
            </CNPJContribuinte>
            <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>
                      <Transforms>
                      <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
                      <Transform Algorithm="http://www.w3c.org/TR/2001/REC-xml-c14n-20010315"/>
                      </Transforms>
                      <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                      <DigestValue>HuMpzscXjIs2qKXGJw7yduTCts0=</DigestValue>
                  </Reference>
              </SignedInfo>
              <SignatureValue>F0Te8gclpt0pW0BNBPCxknBFXs+igy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vbS5icqApBgVgTAEDAqAgEx5TQU5EUkEgUkVHSU5BIE1PUkVJUkEgREEgU0lMVkGgGQYFYEwBAwOgEBMOMjc2NDc2MDQwMDAxODCgPQYFYEwBAwSgNBMyMTgwOTE5NTIxNjM3NzI3MzY0OTAwMDAwMDAwMDAwMDAwMDAwNjMyOTM0NjMzU1NQU1CgFwYFYEwBAwegDhMMMDAwMDAwMDAwMDAwMA0GCSqGSIb3DQEBCwUAA4ICAQAoxgHS34WF1IvwsDgrRlxQuPB/yI2XlT5rzrRpC9BV4+2PIf0AvZLQ5lYpodjI7ECsGg+seAVCR+CInaHVDJUswiSS1E6xZ6P5ioSIFb5pRJ2xKeVkAAf0EH8ayvdM6B6gdZpH72rN2TldjoEveDhcOe3AAHWerD2MWKkw5h39ETAmjSjV9oe+CB5tlpHBUilR2U4a02ScgKmcLF5UK71cKT42PmADShcHwOyMMdkZG8n32ljPyHtVtKh/GXKZPy1TzwiHVJXAjyXlORaJ2Gd1gJza5qN7amVWcaCIHhDQ1T+sy4pPIT7kWFeh7xYh7p5iE/OObsfcKzBv/6c/7moHmboZbFYW3trf+Agqxt7lwUFV4Mcc4frgKKPZLJsAg8QQzzy7pk4+bNFbGSWIbwHm4Ljr3DWD6Epa4boZ1JH4/3OE5ga4sWbTlSsJQINmvK8IckXZZzntA9uF2SauuvD2GOHUzJiorHfUCPlzPB9lYj9hwLxdUbC6RBDC4TDnXtlQFlzc60BQqbTB/YtT6ceA/WK2rvFcPoKeAFgk7qdYrSWxjdqYKaOwrgnrgv/FyFqZKsQQXEN+FCk/WAxqREZOqHnpsoVqofSi/2+AoOiJgpQXJ4ejPqRbDreRetYaYZzDoHN+4Qu8R+LtHdd32KhG2/IwV8A2NqchdNjOHj8GFQ==</X509Certificate>
                </X509Data>
            </KeyInfo>
            </Signature>
          </PedidoConsultaCNPJ>
      </MensagemXML>
    </ConsultaCNPJRequest>
  </soap12:Body>
</soap12:Envelope>

Does anyone have an example of a valid request? Or do you know why you're making this mistake?

    
asked by anonymous 21.06.2018 / 20:22

0 answers