CURL equivalent in Servoy

Questions and answers on developing, deploying and using plugins and JavaBeans

CURL equivalent in Servoy

Postby garroyo » Sun Feb 27, 2022 7:39 pm

Hi all.

How can I translate this curl command to Servoy with the http.plugin ?
Code: Select all
curl --connect-timeout 60 -m 60 -s -S -L --header "Content-Type: application/xml;charset=UTF-8" -H "Accept: application/xml" --cert certificate.pem --key certificate_key.pem --data TBAI2209713_firma.xml  https://tbai-prep.egoitza.gipuzkoa.eus/WAS/HACI/HTBRecepcionFacturasWEB/rest/recepcionFacturas/alta --output salida.xml -v

I have read I must import my certificate in .crt format to cacerts, but then it is not clear how I could create a POST to the URL by passing the file I want with the certificate and its key.
Something similar to this code but I can't get it to complete or run
Code: Select all
           var urlServer = "https://tbai-z.prep.gipuzkoa.eus/sarrerak/alta"; // --- Entorno pruebas.
      var _request
      var _poster = plugins.http.createNewHttpClient();
      _request = _poster.createPostRequest(urlServer);
      var f = plugins.file.convertToJSFile(myXml);
      _request.addFile(null,f.getName(),f)
      
      _request.addHeader("Content-Type", "application/xml;charset=UTF-8");
      
      _request.setCharset('UTF-8');

           var _response = _request.executeRequest()

If someone could tell me how I can adapt it to run on Servoy, I would appreciate it.
garroyo
 
Posts: 14
Joined: Mon Jan 23, 2017 2:01 pm

Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 11 guests

cron