0
I am integrating a system with issuance of fiscal notes. There is an XML search method of the generated note. The return of this query (GET), is an XML. This XML I access and save in a file to use in the future.
I am getting the return and access the xml. However, it is coming with a 'wrong format'':
Example:
<?xml version="1.0" encoding="utf-8"?><string><Nfse xmlns="http://www.abrasf.org.br/ABRASF/arquivos/nfse.xsd"><InfNfse><Numero>20213</Numero>
When the right thing would be:
<Nfse xmlns="http://www.abrasf.org.br/ABRASF/arquivos/nfse.xsd"><InfNfse><Numero>20213</Numero>
It is noticeable that the < xml is being replaced by < and the < by a >
Could try to give a replace to change this.
But to get that content right now, there’s something I can do?
My xml reading function:
Try
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12
Dim Request As WebRequest = WebRequest.Create(url)
Request.Credentials = CredentialCache.DefaultCredentials
Dim auth = "Basic " & buscaAPIKey()
Request.Headers.Add("Authorization", auth)
Request.ContentType = "application/xml"
Using responseStream = Request.GetResponse.GetResponseStream
Using reader As New StreamReader(responseStream)
Dim objResponse As Object = reader.ReadToEnd()
Dim xml As String = objResponse.ToString.Trim
End Using
End Using
Catch ex As Exception
End Try
Changing Request.Contenttype = "application/xml" to "application/json" worked. Simple so rsrs.
– Developer1903