Boa tarde,
estou tentando transmitir uma nfse, para salvador-BA com a seguinte string
string soapAction = "https://nfse.salvador.ba.gov.br/rps/ENVIOLOTERPS/EnvioLoteRPS.svc";
string urlWebService = "https://nfse.salvador.ba.gov.br/rps/ENVIOLOTERPS/EnvioLoteRPS.svc?wsdl";
StringBuilder sb = new StringBuilder();
sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
sb.Append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org\">");
sb.Append("<soapenv:Header>");
sb.Append("</soapenv:Header>");
sb.Append("<soapenv:Body>");
sb.Append(doc.OuterXml.Replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", ""));
sb.Append("</soapenv:Body>");
sb.Append("</soapenv:Envelope>");
HttpWebRequest request = WebRequest.Create(urlWebService) as HttpWebRequest;
request.Timeout = 200000;
request.Headers.Add("SOAPAction", soapAction);
request.Method = "POST";
request.ContentType = "text/xml;charset=UTF-8";
request.ClientCertificates.Add(certificado);
request.UserAgent = "Apache-HttpClient/4.1.1 (java 1.5)";
//request.ContentLength = sb.Length;
var dadosSOAP = Encoding.UTF8.GetBytes(sb.ToString());
using (var stream = request.GetRequestStream())
{
stream.Write(dadosSOAP, 0, dadosSOAP.Length);
}
var response = (HttpWebResponse)request.GetResponse();
respostaWebService = new StreamReader(response.GetResponseStream(), Encoding.UTF8).ReadToEnd();
e retorna o erro O servidor remoto retornou um erro: (500) Erro Interno do Servidor.
lote_rps_000000000005494.xml (10,2,KB)