我有一个问题,我不知道如何解决。我需要通过soap将xml发送到公共服务器。它返回了此错误,我已经检查了好几次了,它似乎不是xml错误。有人可以帮我吗?
private function send($operation, DOMDocument $xmlDoc) {
//versão do SOAP
$soapver = SOAP_1_2;
// $wsdl = 'https://nfe.prefeitura.sp.gov.br/ws/lotenfe.asmx?WSDL';
$wsdl = 'https://nfse.blumenau.sc.gov.br/ws/lotenfe.asmx?WSDL'; // Felipe Rau
$endpoint = "http://nfse.blumenau.sc.gov.br/ws/envioRPS";
$params = array(
'local_cert' => $this->key,
'passphrase' => $this->passphrase,
'connection_timeout' => 300,
'encoding' => 'UTF-8',
'verifypeer' => false,
'verifyhost' => false,
'soap_version' => $soapver,
'trace' => true,
'cache_wsdl' => WSDL_CACHE_NONE,
'location' => $endpoint
);
try {
$this->connectionSoap = new SoapClient($wsdl, $params);
} catch (SoapFault $e) {
throw new \Common\Exception\RuntimeException($e->getMessage());
} catch (Exception $e) {
throw new $e;
}
$this->signXML($xmlDoc);
$xmlDoc->formatOutput = true;
$params = array(
'VersaoSchema' => 1,
//'MensagemXML' => trim($xmlDoc->saveXML())
'MensagemXML' => '<?xml version="1.0" encoding="UTF-8"?><PedidoEnvioRPS xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://nfse.blumenau.sc.gov.br"><Cabecalho xmlns="" Versao="1"><CPFCNPJRemetente><CNPJ>02145346000103</CNPJ></CPFCNPJRemetente></Cabecalho><RPS xmlns=""><Assinatura>Hw4rqRIbF84mJ2X8Ycn4GYjjvVtuNEKDdZvKZkznvx1JliJWlfYtm7qkh319yDtZGVvQfv/3tj7/PoLlARCOcC+Z17ht+ChxUMJOtxWma2oiXIh10IfBd3scchsIg6JKwL4j9A/hvETzuFvn3IOETKsWku2FTmYnHGZiCsak0zu8uy/hAPIvmoU9W78zRCIy3xYoVJVyrta/r519pHiCzYYP/tD66jyqxzhoZxfVRpBUOjQHu9pVd8mwsbQlZdi+faCPvnWq4kNCj7xROOopZ+8yG5UKpt4e87CP4oWjMR24RiLiVKCmh/vNzHSLvuQ55J5nrksLH3vq6XmhnE0rOA==</Assinatura><ChaveRPS><InscricaoPrestador>60745</InscricaoPrestador><SerieRPS>001</SerieRPS><NumeroRPS>217</NumeroRPS></ChaveRPS><TipoRPS>RPS</TipoRPS><DataEmissao>2019-02-20</DataEmissao><StatusRPS>N</StatusRPS><TributacaoRPS>T</TributacaoRPS><ValorServicos>1</ValorServicos><ValorDeducoes>0</ValorDeducoes><CodigoServico>07498</CodigoServico><AliquotaServicos>0.05</AliquotaServicos><ISSRetido>false</ISSRetido><CPFCNPJTomador><CPF>06005738933</CPF></CPFCNPJTomador><RazaoSocialTomador>Felipe RAu</RazaoSocialTomador><EnderecoTomador><TipoLogradouro>R</TipoLogradouro><Logradouro>Rua Frederico Giewlo</Logradouro><NumeroEndereco>numero</NumeroEndereco><ComplementoEndereco>complemento</ComplementoEndereco><Bairro>bairro_do_destinatario</Bairro><Cidade>3550308</Cidade><UF>SP</UF><CEP>89040362</CEP></EnderecoTomador><EmailTomador>felipe@bonssens.com.br</EmailTomador><Discriminacao>Teste de geracao de NFS-e via sistema proprio</Discriminacao></RPS><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=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>S8Ljeg044AoZnrj69iIR7ib8t2U=</DigestValue></Reference></SignedInfo><SignatureValue>i8g3iWtpSJq//qL0WuDPY0jKOKIC9jKZ+yN2bs75Ll1JeAUwVjrNf9RXq67xvu3JY7h4UWsexNUXSEW45tWH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ODYzNjAwMjkxNTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwoBcGBWBMAQMHoA4TDDAwMDAwMDAwMDAwMDANBgkqhkiG9w0BAQsFAAOCAgEAMonzbAchXNWOgquQFSjHAreUcNm00Etqx50/s0j5bXppp88wpRUo5XQGNCKDe+UO4sX13sMgTxS9rdK2yhzMm1B4hE9ajnUltJ2dwLJbbY0/jtR7lksKwxF/MzRsLDb0NI0UOMI7VT4OnTgLx9b1wt6h8RZdvhKp7YZVHf17sIyeovw45bA3qJHVw8PgSkbx0Q56J79+BVwvZKrdbsdriRWdL2/lUoeG+js4GgPf2492DK2Cuex+NGOVLtS5FjKbcVpwmt65P1b3OBBLL58VrWMbdHWCNqD6Tie7iO3AWG0axWRMEsxyqbP2fDAzEQVrswwe8XPjzp39/6FTKhpn2V3mw3S+4uu13VMjZ16dEmsw21otRMm6bBYF8jyYyk1OUVfw6xzxvd454jPbMomm1Uj58tHGR7p2jgwROEh9MbhQLsnWBWjn1azvnjN1E8jR+C+3pYkh97ROXke6Bv958eUArrzaOVyETU5176W2JNlXQf6OQGoGlBfAjL5E971wk7xs7Vr3SkRTthkrPoirxeNs3qInnknqRvwHMLeM4+Xm2dbaUSXfvVAsbWpmzHYJNjA10s6IHGz0BKRMqGO+ky+WyLV+zfCp5xGUngnxCukeVDZkFKpTp3BsdP6GCuwJ4IgzsvpzuNS1dCXbXZOcaVVD89sbA2thNVmVypt0XXI=</X509Certificate></X509Data></KeyInfo></Signature></PedidoEnvioRPS>'
);
/*$dirfile = "arquivos_clientes/02145346000103/nfse";
$filename = "paulista-nfse.xml";
$filexmlMdfe = $dirfile."/".$filename;
file_put_contents($filexmlMdfe, $xmlDoc->saveXML()); // Salva o xml
echo "aqui";
die();*/
// try {
//$this->connectionSoap->__soapCall("LoteNFeSoap", $params);
$result = $this->connectionSoap->$operation($params);
//$function = 'EnvioRPS';
//$arguments = ['EnvioRPS' => ['xml'=>$xmlDoc->saveXML()]];
//$result = $this->connectionSoap->__soapCall($function, $params);
print_r($result->RetornoXML);
/* echo($this->connectionSoap->__getLastResponse());
echo PHP_EOL;
echo($this->connectionSoap->__getLastRequest());*/
die();
//} catch (SoapFault $e) {
// print_r($result->RetornoXML);
// echo PHP_EOL;
// echo($this->connectionSoap->__getLastResponse());
// echo PHP_EOL;
// echo($this->connectionSoap->__getLastRequest());
// die();
// throw new \Common\Exception\RuntimeException($e->getMessage());
// } catch (Exception $e) {
// throw new $e;
// }
return new SimpleXMLElement($result->RetornoXML);
}
返回错误:“致命错误:未捕获的SoapFault异常:[发件人] 看起来我们没有XML文档 C:\ wamp64 \ www \ NovoFac \ nfephp \ libs \ NFSe \ NFSeSP.class.php行217“