FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour web service
Posts: 74
Joined: Sun Aug 27, 2017 07:18 PM
web service
Posted: Sat Jul 24, 2021 09:08 PM
Buenas tardes

Me gustaría saber si algún colega puede hacer un ejemplo de acceso al servicio web basado en alguno de estos ejemplos para xharbour.

El objetivo será permitir el envío de facturas de servicios al servicio web.


Code (fw): Select all Collapse
LibCurl

CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL,
"http://ws.prefeituradeatibaia.com.br/WSNfses/nfseresources/ws/v2/emissao/simula");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "postman-token: 26e44762-e741-d9bc-d1e4-200f018ad85f");
headers = curl_slist_append(headers, "cache-control: no-cache");
headers = curl_slist_append(headers, "content-type: application/xml");
headers = curl_slist_append(headers, "authorization: 999991-2EU2TPWLJBP2H57HL605K24778989PPP");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, " XML A SER ENVIADO");
CURLcode ret = curl_easy_perform(hnd);


cURL
curl -X POST \
 http://ws.prefeituradeatibaia.com.br/WSNfses/nfseresources/ws/v2/emissao/simula \
 -H 'authorization: 999991-2EU2TPWLJBP2H57HL605K24778989PPP' \
 -H 'cache-control: no-cache' \
 -H 'content-type: application/xml' \
 -H 'postman-token: 25a25272-851b-1763-f96f-6ac0017ad209' \
 -d ' XML A SER ENVIADO'


 C# Sharp
var client = new RestClient("http://ws.prefeituradeatibaia.com.br/WSNfses/nfseresources/ws/v2/emissao/simula");
var request = new RestRequest(Method.POST);
request.AddHeader("postman-token", "f6645f63-84a0-36b8-0e37-b26a359830ae");
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/xml");
request.AddHeader("authorization", "999991-2EU2TPWLJBP2H57HL605K24778989PPP");
request.AddParameter("application/xml", " XML A SER
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: web service
Posted: Sat Jul 24, 2021 09:42 PM
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces

Continue the discussion