Comments (1)
En el PHPSatQueryRequest.php deberían de modificarlo para que quedará de la siguiente manera:
`<?php
namespace SWServices\SatQuery;
use Exception;
class SatQueryRequest {
public static function soapRequest($url, $rfcEmisor, $rfcReceptor, $total, $uuid) {
$xml_post_string = SatQueryRequest::getSoapBody($rfcEmisor, $rfcReceptor, $total, $uuid);
$headers = SatQueryRequest::headers($xml_post_string);
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 50000);
set_time_limit(0);
$soap = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if ($err) {
throw new Exception("cURL Error #:" . $err);
} else {
return SatQueryRequest::response(SatQueryRequest::xml2array($soap));
}
}
public static function getSoapBody($rfcEmisor, $rfcReceptor, $total, $uuid) {
return '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:Consulta>
<tem:expresionImpresa><![CDATA[?re=' . $rfcEmisor . '&rr=' . $rfcReceptor . '&tt=' . $total . '&id=' . $uuid . ']]></tem:expresionImpresa>
</tem:Consulta>
</soapenv:Body>
</soapenv:Envelope>';
}
public static function headers($xml_post_string) {
return array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: http://tempuri.org/IConsultaCFDIService/Consulta",
"Content-length: " . strlen($xml_post_string),
);
}
public static function xml2array($xml) {
return json_decode(json_encode(simplexml_load_string(str_replace("s:", "", str_replace("a:", "", '<?xml version="1.0" encoding="utf-8"?>' . $xml)))), TRUE);
}
public static function response($data) {
$obj = (object) [];
$obj->CodigoEstatus = $data["Body"]["ConsultaResponse"]["ConsultaResult"]["CodigoEstatus"];
$obj->Estado = $data["Body"]["ConsultaResponse"]["ConsultaResult"]["Estado"];
$obj->EsCancelable = $data["Body"]["ConsultaResponse"]["ConsultaResult"]["EsCancelable"];
$obj->EstatusCancelacion = $data["Body"]["ConsultaResponse"]["ConsultaResult"]["EstatusCancelacion"];
return $obj;
}
}
`
Ya con esto se obtienen todos los elementos en la respuesta del SOAP, adicional a esto, en el CURL se deshabilitan los timeout, la verificación del SSL, esto por sí caducan los certificados del PAC. saludos.
from sw-sdk-php.
Related Issues (6)
- Error en la clase CancelationService HOT 1
- Detalle sobre escribiendo el espacio global
- Composer can't load library HOT 1
- Referencias agregadas en último commit (require_once) rompen la libreria y ya no podemos llamar al servicio de emisión de facturas HOT 2
- require_once(SWServices/Helpers/ResponseHelper.php): failed to open stream: No such file or directory HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sw-sdk-php.