web service

web service

Postby jair » Sat Jul 24, 2021 9: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: Select all  Expand view

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

jair
 
Posts: 48
Joined: Sun Aug 27, 2017 7:18 pm

Re: web service

Postby cnavarro » Sat Jul 24, 2021 9: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
User avatar
cnavarro
 
Posts: 6520
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 52 guests