Bueno aqui otra vez pidiendo ayuda, fijense que todo iba bien con estos chavos de tralix, pero ayer que me puse a trabajar con un nuevo cliente, al momento de llamar el ws me arroja este
error:
Could not establish trust relationship for the SSL/TLS secure channel.
anduve indagando, y se supone que es por lo certificados, ya que el de tralix es HTTPS, realice las soluciones que me e encontrado donde se fuerza supuestamente a que el certificado se acepte, si bien lo acepta, al momento de enviar la info me da el bad request.
espero ser claro, abajo dejo pequeno codido donde sucede esto.
Código: Seleccionar todo
Dim encoding As New ASCIIEncoding
Dim strSoapEnvelope As String = ""
strSoapEnvelope = String.Format("<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:cfdi=""http://www.sat.gob.mx/cfd/3""><soapenv:Header/><soapenv:Body>{0}</soapenv:Body></soapenv:Envelope>", xml)
Dim buffer() As Byte = encoding.GetBytes(strSoapEnvelope)
Dim req As Net.HttpWebRequest
req = DirectCast(HttpWebRequest.Create("https://pruebastfd.tralix.com:7070"), HttpWebRequest)
req.Headers.Add("SOAPAction", "urn:TimbradoCFD")
req.Headers.Add("CustomerKey", "xxxxxxxxxxxxxxxxxxxxxxxxxxx")
req.Method = "POST"
req.ContentType = "text/xml;charset=UTF-8"
req.UserAgent = "Apache-HttpClient/4.1.1"
req.Host = "pruebastfd.tralix.com:7070"
req.ContentLength = buffer.Length
'ByPass SSL Certificate Validation Checking
System.Net.ServicePointManager.ServerCertificateValidationCallback = Function(se As Object, cert As System.Security.Cryptography.X509Certificates.X509Certificate, chain As System.Security.Cryptography.X509Certificates.X509Chain, sslerror As System.Net.Security.SslPolicyErrors) True
Dim newStream As Stream = req.GetRequestStream() '<------- aqui marca el error de SSL/TLS, con la instruccion de arriva fueerzo a que se acepte y pasa a la siguiente linea
'Call web application/web service with HTTPS URL
newStream.Write(buffer, 0, buffer.Length)
newStream.Close()
Dim response1 As HttpWebResponse = DirectCast(req.GetResponse(), HttpWebResponse) '<----ya esta parte me arroja el erro del bad request, pero si quito la funcion de aceptacion, me arroja el error de SSL/TLS
Dim dataStream As Stream = response1.GetResponseStream()
Dim reader1 As New StreamReader(dataStream)
Gracias