WinHTTPRequest and ceertified .PFX
iperutility
Member Posts: 18
Hello,
I need to open a comunication with the server belove
CLEAR(WinHTTPRequest);
CREATE(WinHTTPRequest);
WinHTTPRequest.Open('POST','https://www.sgate.anci.it/sgate-gas-web-services/services',FALSE);
WinHTTPRequest.SetClientCertificate('\LOCAL_MACHINE\My\1245-AUSA'); // SGATE ECERTIFICATE
WinHTTPRequest.SetCredentials('AUSA', 'GxG.XXXX', 0);
WinHTTPRequest.Send(XML);
well I have registered the ceritified by this command
winhttpcertcfg PFXFile -i -c LOCAL_MACHINE\My -a SV-IU-DBS -p XXXXXX
and after I have putted those register with mmc console
But don't works.
One my college had doing this code in C#, but in NAV C/AL I haven't found any of similar istructions :
SgateWebService ws = new SgateWebService();
ws.ClientCertificates.Add(X509Certificate.CreateFromCertFile(pathCertificati + "SGATE.cer"));
ws.ClientCertificates.Add(X509Certificate.CreateFromCertFile(pathCertificati + "GeoTrustPCA.cer"));
ws.ClientCertificates.Add(X509Certificate.CreateFromCertFile(pathCertificati + "GeoTrustEV.cer"));
ws.ClientCertificates.Add(new X509Certificate(pathCertificati + "389-YYYYY.pfx", "XXXXXX"));
ws.Timeout = 240 * 1000;
return ws;
He had not registered the certifieds in the comuter, but he had sent these how you can see.
Someone of you have never used certified .PFX with WinHTTPRequest?
every time I run the procedure this give me error : "You need to have a certified to connect...."
](*,) ](*,)
I need to open a comunication with the server belove
CLEAR(WinHTTPRequest);
CREATE(WinHTTPRequest);
WinHTTPRequest.Open('POST','https://www.sgate.anci.it/sgate-gas-web-services/services',FALSE);
WinHTTPRequest.SetClientCertificate('\LOCAL_MACHINE\My\1245-AUSA'); // SGATE ECERTIFICATE
WinHTTPRequest.SetCredentials('AUSA', 'GxG.XXXX', 0);
WinHTTPRequest.Send(XML);
well I have registered the ceritified by this command
winhttpcertcfg PFXFile -i -c LOCAL_MACHINE\My -a SV-IU-DBS -p XXXXXX
and after I have putted those register with mmc console
But don't works.
One my college had doing this code in C#, but in NAV C/AL I haven't found any of similar istructions :
SgateWebService ws = new SgateWebService();
ws.ClientCertificates.Add(X509Certificate.CreateFromCertFile(pathCertificati + "SGATE.cer"));
ws.ClientCertificates.Add(X509Certificate.CreateFromCertFile(pathCertificati + "GeoTrustPCA.cer"));
ws.ClientCertificates.Add(X509Certificate.CreateFromCertFile(pathCertificati + "GeoTrustEV.cer"));
ws.ClientCertificates.Add(new X509Certificate(pathCertificati + "389-YYYYY.pfx", "XXXXXX"));
ws.Timeout = 240 * 1000;
return ws;
He had not registered the certifieds in the comuter, but he had sent these how you can see.
Someone of you have never used certified .PFX with WinHTTPRequest?
every time I run the procedure this give me error : "You need to have a certified to connect...."
](*,) ](*,)
0
Comments
-
Hello,
I have a problem, I need to use with HTTP request some certifieds, how you can see below in the senteces C/AL.
IF CREATE(WinHTTPRequest,TRUE,TRUE) THEN BEGIN
CREATE(XMLDoc,TRUE,TRUE);
WinHTTPRequest.Open('POST','http://www.sgate.anci.it/sgate-gas-web-services/services',FALSE);
WinHTTPRequest.SetClientCertificate('LOCAL_MACHINE\My\1245-AUSA');
WinHTTPRequest.SetClientCertificate('LOCAL_MACHINE\My\GeoTrustEV');
WinHTTPRequest.SetClientCertificate('LOCAL_MACHINE\My\GeoTrustPCA');
WinHTTPRequest.SetClientCertificate('LOCAL_MACHINE\My\SGATE');
WinHTTPRequest.SetCredentials('AUSA', 'mmmmm', 0);
WinHTTPRequest.SetRequestHeader('Content-type', 'text/xml; charset=utf-8');
WinHTTPRequest.SetTimeouts(360000,360000,360000,360000);
WinHTTPRequest.Send('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"'
+ ' xmlns:xsd="http://www.sgate.ancitel.it/xsd/">'
+ ' <soapenv:Header/>'
+ ' <soapenv:Body>'
+ ' <xsd:richiestaPresaInCaricoLotto>'
+ ' <xsd:mittente>'
+ ' <xsd:login>AUSA</xsd:login>'
+ ' <xsd:password>yyyyyy</xsd:password>'
+ ' </xsd:mittente>'
+ ' <xsd:idUltimoLottoRicevutoCorrettamente>446983721</xsd:idUltimoLottoRicevutoCorrettamente>'
+ ' <xsd:numeroMessaggi>5</xsd:numeroMessaggi>'
+ ' </xsd:richiestaPresaInCaricoLotto>'
+ ' </soapenv:Body>'
+ '</soapenv:Envelope>');
IF WinHTTPRequest.Status <> 200 THEN
MESSAGE('Http Error ' + ' ' + FORMAT(WinHTTPRequest.Status) + ': ' + WinHTTPRequest.StatusText)
ELSE BEGIN
MESSAGE('Http Risposta ' + ' ' + WinHTTPRequest.StatusText);
XMLDoc.async := FALSE;
XMLDoc.load(WinHTTPRequest.ResponseBody);
XMLNode := XMLDoc.selectSingleNode('//Soap:Envelope/Soap:Body/'+ Text002 +'_Result/return_value/');
IF NOT ISCLEAR(XMLNode) THEN
MESSAGE(XMLNode.text)
ELSE BEGIN
XMLDoc.save('C:\Dati\Lotti\response.xml');
HYPERLINK('C:\Dati\Lotti\response.xml');
END;
END;
CLEAR(XMLDoc);
END;
I had register the certifieds by prompt command :
1) winhttpcertcfg PFXFile -i -c LOCAL_MACHINE\My -a SV-IU_SERVER -p PFXPassword
2) winhttpcertcfg -g -c LOCAL_MACHINE\My -s "1245-AUSA" -a "administrator"
3) winhttpcertcfg -g -c LOCAL_MACHINE\My -s "1245-AUSA" -a "NetworkService"
4) winhttpcertcfg -g -c LOCAL_MACHINE\My -a "1245-AUSA" -a "ASPNET"
5) winhttpcertcfg -i -c LOCAL_MACHINE\My -a "administrator"
afert, I had registerd the certifieds, using MMC interface, but didn't works.
My colleague, that works in C#, had resolved sending, by DLL proxy webservice, the certicates in this mode :
SgateWebService ws = new SgateWebService();
ws.ClientCertificates.Add(X509Certificate.CreateFromCertFile(pathCertificati + "SGATE.cer"));
ws.ClientCertificates.Add(X509Certificate.CreateFromCertFile(pathCertificati + "GeoTrustPCA.cer"));
ws.ClientCertificates.Add(X509Certificate.CreateFromCertFile(pathCertificati + "GeoTrustEV.cer"));
ws.ClientCertificates.Add(new X509Certificate(pathCertificati + "ooooo.pfx", "ppooooo"));
ws.Timeout = 240 * 1000;
Now I would know if in C/AL exist a DLL DotNet or Automation for use "X509Certificate", and apply the same solution of my colleague, sending the certifeds without reading thwse from server's register by this sentence :
WinHTTPRequest.SetClientCertificate('LOCAL_MACHINE\My\1245-AUSA');
WinHTTPRequest.SetClientCertificate('LOCAL_MACHINE\My\GeoTrustEV');
WinHTTPRequest.SetClientCertificate('LOCAL_MACHINE\My\GeoTrustPCA');
WinHTTPRequest.SetClientCertificate('LOCAL_MACHINE\My\SGATE');
](*,)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 329 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions