[Stackoverflow] [Progress OpenEdge ABL] Make a post with a certificate Progress OpenEdge

  • Thread starter Thread starter Raulitop 128
  • Start date Start date
Status
Not open for further replies.
R

Raulitop 128

Guest
I'm using V-11.7 and I have no problems using HttpClient in differents scenarios, GET, POST, uploading files, getting the responses, etc. But now I have to upload an XML to an public admnistracion URL's that requires a valid certificate.

I have to use a P12 cert to connect to a webservice and I don't see the way.

Alternativelly I'm using cURL to accomplish this using this command:

Code:
lcComan = "C:\Teragest\FacE\curl.exe" +
                            " -k" +
                            " -H " + CHR(34) + "Content-type: application/xml;charset=UTF-8" + CHR(34) +
                            " --data-binary @" + lcFiche + ".xml" +
                            " -o " + lcFiche + "out.xml" +
                            " -v" +
                            " --key " + lcpemKey + 
                            " --cacert " + lcpemCacert +
                            " --cert " + lcpemCert + ":" + lcpemPass +
                            " " + lcUrl.   
                    OS-COMMAND VALUE(lcComan).

I don't have to receive a binary, he response in this case is a simple XML.

I tried to add header that reference the certificate but didnt work at all:

Code:
oLib        = ClientLibraryBuilder:Build():sslVerifyHost(NO):LIBRARY. /*ServerNameIndicator("pruebas-   ticketbai.araba.eus"):SetSSLProtocols(cSSLProtocols):SetSSLCiphers(cSSLCiphers):library. */
oHttpClient = ClientBuilder:Build():UsingLibrary(oLib):Client.                   
oRequest    = RequestBuilder:Post(lcUrl,oDocument):AddHeader("Content-Type","application/xml;charset=UTF-8")
                                              :AddHeader("key", lcpemKey)  
                                              :AddHeader("cacert", lcpemCacert) 
                                              :AddHeader("--cert-type","P12")
                                              :AddHeader("--cert", cRuta + cNif + ".p12" + ":" + lcpemPass):Request.                                                                                                                                                                           
oResponse   = ResponseBuilder:Build():Response.
oHttpClient:Execute(oRequest, oResponse).`

There is a method to do this with HttpClient? Thank you all!

Continue reading...
 
Status
Not open for further replies.
Back
Top