Resolved SOAP error

Hello,

I have an issue with a SOAP connection,
I get the error:
"Fallo en Secure Socket Layer (SSL). código de error 0: Unknown SSL error (9318) Falla en la conexón al host consultaqr.facturaelectronica.sat.gob.mx en el puerto 443 transporte TCP. (9407)"
Translated something like
"Fail in Secure Socket Layer (SSL). error code 0: Unknown SSL error (9318) Fail in connection to host consultaqr.facturaelectronica.sat.gob.mx on port 443 transport TCP. (9407)"

Code:
USING OpenEdge.Core.*.
USING OpenEdge.Net.HTTP.*.
USING OpenEdge.Net.HTTP.IHttpClientLibrary.
USING OpenEdge.Net.HTTP.Lib.ClientLibraryBuilder.
USING OpenEdge.Net.URI.

DEFINE VARIABLE cDLC  AS CHARACTER NO-UNDO.
DEFINE VARIABLE oLib AS IHttpClientLibrary NO-UNDO.
DEFINE VARIABLE oRequest                 AS IHttpRequest                 NO-UNDO.
DEFINE VARIABLE oResponse                AS IHttpResponse                NO-UNDO.
DEFINE VARIABLE oURI                     AS URI                          NO-UNDO.
DEFINE VARIABLE oRequestBody             AS OpenEdge.Core.String         NO-UNDO.
DEFINE VARIABLE hXMLHandle               AS HANDLE                       NO-UNDO.
DEFINE VARIABLE lcXML                    AS LONGCHAR                     NO-UNDO.

/* Web Service based on this public WS http://www.dneonline.com/calculator.asmx . It consumes the WebService executing the Add Operation. */

oRequestBody =  NEW OpenEdge.Core.String(
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">' +
'   <soapenv:Header/>' +
'   <soapenv:Body>' +
'      <tem:Consulta>' +
'         <tem:expresionImpresa>' +
'<![CDATA[?re=CBE070913344&rr=CCO0309098N8&tt=28903.17&id=04C979D3-2D0F-45A1-AD80-E4625B7C5192]]>' +
'         </tem:expresionImpresa>' +
'      </tem:Consulta>' +
'   </soapenv:Body>' +
'</soapenv:Envelope>'
).

oLib = ClientLibraryBuilder:Build()
        :sslVerifyHost(NO)
        :Library.

oURI = URI:Parse("https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc").
oRequest = RequestBuilder:Post(oUri, oRequestBody)
                         :ContentType('text/xml;charset=UTF-8')
                         :AcceptAll()
 :AddHeader('SOAPAction', 'http://tempuri.org/IConsultaCFDIService/Consulta')
                         :Request.

oResponse = ClientBuilder:Build()
                          :UsingLibrary(oLib)
                          :Client
                          :Execute(oRequest).

IF oResponse:StatusCode <> 200 THEN
   DO:
    MESSAGE "http error: " oResponse:StatusCode VIEW-AS ALERT-BOX.
    RETURN ERROR "Request Error: " + STRING(oResponse:StatusCode).
   END.
ELSE
  DO:
    hXMLHandle = CAST(oResponse:Entity,WidgetHandle):Value.
    hXMLHandle:SAVE('LONGCHAR',lcXML).
    MESSAGE STRING(lcXML) VIEW-AS ALERT-BOX.
 END.

AIX
OpenEdge 11.6.3

Any ideas?


PS. I tested the SOAP on windows with Powershell, and it works fine,

Code:
PS C:\Users\F62109A> $params = @{
>> "Content-type"="text/xml;charset=utf-8"
>> "SOAPAction"="http://tempuri.org/IConsultaCFDIService/Consulta"
>> };
PS C:\Users\F62109A> $body = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"><soapenv:Header/><soapenv:Body><tem:Consulta><tem:expresionImpresa><![CDATA[?re=CBE070913344&rr=CCO0309098N8&tt=28903.17&id=04C979D3-2D0F-45A1-AD80-E4625B7C5192]]></tem:expresionImpresa></tem:Consulta></soapenv:Body></soapenv:Envelope>'
PS C:\Users\F62109A> $response = Invoke-WebRequest -Uri https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc -Method POST -Body $body -Headers $params
PS C:\Users\F62109A> $response.Content
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><ConsultaResponse xmlns="http://tempuri.org/"><ConsultaResult xmlns:a="http://schemas.datacontract.org/2004/07/Sat.Cfdi.Negocio.ConsultaCfdi.Servicio" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:CodigoEstatus>S - Comprobante obtenido satisfactoriamente.</a:CodigoEstatus><a:EsCancelable>Cancelable con aceptación</a:EsCancelable><a:Estado>Vigente</a:Estado><a:EstatusCancelacion>En proceso</a:EstatusCancelacion><a:ValidacionEFOS>200</a:ValidacionEFOS></ConsultaResult></ConsultaResponse></s:Body></s:Envelope>
 
You need to install the relevant root CA certificate in the OpeNEdge cert store. OE does not do this automatically for you.

The easiest way, often, is to put the URL in your browser, and download the certificate from there. Note that you don't need the chain, just the root CA.

Download to the computer and run certutil /path/to/cert.pem -import from proenv.

You should get further after this.
 
You need to install the relevant root CA certificate in the OpeNEdge cert store. OE does not do this automatically for you.

The easiest way, often, is to put the URL in your browser, and download the certificate from there. Note that you don't need the chain, just the root CA.

Download to the computer and run certutil /path/to/cert.pem -import from proenv.

You should get further after this.
Hello Peter, I did but I get the same error.
I tested with a CREATE SOCKET and get the cert error, so I installed the cert (I do that with mkhashfile), after that, I don't get the cert error. But still is not working the program, with the same error message.
 
Justi in case, I did with "certutil":
Code:
proenv>certutil -import /home/mmendoza/certs/satfac1.crt
Importing trusted certificate to alias name: 062cdee6
But I still get the same error,
 
Back
Top