Marques Posted January 23, 2024 at 12:16 PM Report Share #632658 Posted January 23, 2024 at 12:16 PM Bom dia Alguém poderia disponibilizar o código para envio de GT à AT via Webservice em C# ou VB? Obrigado Link to comment Share on other sites More sharing options...
SirMilk Posted August 22, 2024 at 09:14 AM Report Share #633427 Posted August 22, 2024 at 09:14 AM Bom dia Alguém está a conseguir fazer chamadas para o endpoint das guias de transporte? (https://servicos.portaldasfinancas.gov.pt:701/sgdtws/documentosTransporte/) Há 1 mês que tento e não consigo... Validei no site do efatura a minha payload e estou a usar um código que um membro deixou aqui para se testar: $cert_pem = 'TesteWebservices.pem'; $pass_cert = 'TESTEwebservice'; $url = 'https://servicos.portaldasfinancas.gov.pt:701/sgdtws/documentosTransporte/'; $soap_xml = file_get_contents('request.xml'); // Replace with the actual XML content or load from a file $curl = curl_init($url); curl_setopt($curl, CURLOPT_FRESH_CONNECT, TRUE); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: text/xml; charset=utf-8', 'SOAPAction: ""', 'Accept: text/xml', 'Cache-Control: no-cache' )); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); curl_setopt($curl, CURLOPT_VERBOSE, true); // for debugging curl_setopt($curl, CURLOPT_AUTOREFERER, TRUE); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $soap_xml); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_SSLCERT, $cert_pem); // PEM certificate curl_setopt($curl, CURLOPT_SSLCERTTYPE, 'PEM'); curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $pass_cert); curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'TLSv1'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($curl); // Check for errors if ($response === false) { echo 'Error:' . curl_error($curl); } else { // Get detailed information about the request $info = curl_getinfo($curl); echo "Request Info:\n"; print_r($info); echo "\n\nResponse:\n"; echo $response; } var_dump($response); die(); Mas obtenho sempre esta resposta: < HTTP/1.1 500 Error < Content-Type: text/xml; charset=utf-8 < X-Backside-Transport: FAIL FAIL < Connection: close < Strict-Transport-Security: max-age=31536000; includeSubDomains < * Closing connection Request Info: Array ( [url] => https://servicos.portaldasfinancas.gov.pt:701/sgdtws/documentosTransporte/ [content_type] => text/xml; charset=utf-8 [http_code] => 500 [header_size] => 177 [request_size] => 1844 [filetime] => -1 [ssl_verify_result] => 19 [redirect_count] => 0 [total_time] => 0.122543 [namelookup_time] => 0.015001 [connect_time] => 0.02725 [pretransfer_time] => 0.102438 [size_upload] => 1632 [size_download] => 232 [speed_download] => 1893 [speed_upload] => 13317 [download_content_length] => -1 [upload_content_length] => 1632 [starttransfer_time] => 0.122449 [redirect_time] => 0 [redirect_url] => [primary_ip] => 62.28.254.207 [certinfo] => Array ( ) [primary_port] => 701 [local_ip] => 172.30.52.66 [local_port] => 40952 [http_version] => 2 [protocol] => 2 [ssl_verifyresult] => 0 [scheme] => HTTPS [appconnect_time_us] => 102361 [connect_time_us] => 27250 [namelookup_time_us] => 15001 [pretransfer_time_us] => 102438 [redirect_time_us] => 0 [starttransfer_time_us] => 122449 [total_time_us] => 122543 [effective_method] => POST [capath] => /etc/ssl/certs [cainfo] => /etc/ssl/certs/ca-certificates.crt ) Response: <?xml version='1.0' ?> <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <env:Body> <env:Fault> <faultcode>env:Client</faultcode> <faultstring>Internal Error</faultstring> </env:Fault> </env:Body> </env:Envelope> string(232) "<?xml version='1.0' ?> <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <env:Body> <env:Fault> <faultcode>env:Client</faultcode> <faultstring>Internal Error</faultstring> </env:Fault> </env:Body> </env:Envelope> " Alguém me pode ajudar, por favor? É a primeira vez que tento fazer uma integração com a AT! Obrigado! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now