Prezados,
Fiz diversas alterações e correções em no XML do envelope SOAP e resolveu o problema 500 mas, surgiu outro problema.
Atualmente estou enviando o seguinte XML:
StringBuilder sbEnvelope = new StringBuilder();
sbEnvelope.Append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:nfse=\"http://tempuri.org/\">");
sbEnvelope.AppendLine("<soapenv:Header>");
sbEnvelope.AppendLine("</soapenv:Header>");
sbEnvelope.AppendLine("<soapenv:Body>");
sbEnvelope.AppendLine("<nfse:cabecalho versao=\"1.0\">");
sbEnvelope.AppendLine("<nfse:versaoDados>2.03</nfse:versaoDados>");
sbEnvelope.AppendLine("</nfse:cabecalho>");
sbEnvelope.AppendLine("<nfse:RecepcionarLoteRps>");
sbEnvelope.AppendLine("<nfse:xmlEnvio>" + xmlBody.Replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "") + "</nfse:xmlEnvio>");
sbEnvelope.AppendLine("</nfse:RecepcionarLoteRps>");
sbEnvelope.AppendLine("</soapenv:Body>");
sbEnvelope.AppendLine("</soapenv:Envelope>");
Ao enviar esse XML recebo o erro que segue a abaixo, mas a tag EnviarLoteRpsEnvio está no XML antes da tag LoteRps, conforme schema.
<?xml version="1.0"?>
-<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
-<s:Body>
-<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode>
<faultstring xml:lang="pt-BR">Erro durante a desserialização do corpo da mensagem de solicitação para a operação 'RecepcionarLoteRps'.</faultstring>
-<detail>
-<ExceptionDetail xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel">
<HelpLink i:nil="true"/>
-<InnerException>
<HelpLink i:nil="true"/>
-<InnerException>
<HelpLink i:nil="true"/>
<InnerException i:nil="true"/>
<Message>Espera-se elemento End 'EnviarLoteRpsEnvio' no namespace 'http://www.abrasf.org.br/nfse.xsd'. Encontrado elemento 'LoteRps' do namespace 'http://www.abrasf.org.br/nfse.xsd'. Linha 1, posição 376.</Message>
<StackTrace> em System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)em System.Xml.XmlExceptionHelper.ThrowEndElementExpected(XmlDictionaryReader reader, String localName, String ns)em System.Xml.XmlBaseReader.ReadEndElement()em System.Xml.XmlBaseReader.ReadElementString()em Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderINFSEGeracao.Read23_RecepcionarLoteRps()em Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer20.Deserialize(XmlSerializationReader reader)em System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)</StackTrace>
<Type>System.Xml.XmlException</Type>
</InnerException>
<Message>Erro no documento XML (1, 376).</Message>
<StackTrace> em System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)em System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)</StackTrace>
<Type>System.InvalidOperationException</Type>
</InnerException>
<Message>Erro durante a desserialização do corpo da mensagem de solicitação para a operação 'RecepcionarLoteRps'.</Message>
<StackTrace> em System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)em System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)em System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)em System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)em System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)em System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)em System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)em System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)em System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)em System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)em System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)em System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)em System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)em System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)em System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>
<Type>System.ServiceModel.CommunicationException</Type>
</ExceptionDetail>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Alguma dita do que está ocorrendo?
Grato,
Renato