Page 1 of 1

web service

Posted: Sat Jul 24, 2021 9:08 pm
by jair
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


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


Re: web service

Posted: Sat Jul 24, 2021 9:42 pm
by cnavarro