
Webservice de envíos - extraer la informacion de una clase
Publicado por Fernando (14 intervenciones) el 17/07/2017 21:56:18
Buenas tardes,
Estoy programando un Webservice en PHP, consigo el resultado que es el siguiente:
stdClass Object ( [ExecuteQueryResult] => stdClass Object ( [errorCode] => 0 [errorCodeDescriptionSPA] => [errorCodeDescriptionENG] => [trackingData] => stdClass Object ( [TrackingData] => stdClass Object ( [waybill] => 8055241528464720099314 [shortWaybillId] => 3390363075 [serviceId] => 72 [serviceDescriptionSPA] => Servicio Terrestre Prepagado sin credito [serviceDescriptionENG] => Servicio Terrestre Prepagado sin credito [customerNumber] => 5241528 [packageType] => Paquete [additionalInformation] => [statusSPA] => CONFIRMADO [statusENG] => DELIVERED [pickupData] => stdClass Object ( [originAcronym] => MRL [originName] => Moroléon [pickupDateTime] => 07/02/2017 06:36:00 p.m. ) [deliveryData] => stdClass Object ( [destinationAcronym] => CUL [destinationName] => Culiacán [deliveryDateTime] => 13/02/2017 12:22:00 p.m. [zipCode] => 80240 [receiverName] => SOE: MARIA GAXIOLA ) [history] => stdClass Object ( [History] => Array ( [0] => stdClass Object ( [eventDateTime] => 29/08/2013 06:42:00 a.m. [eventId] => SCON [eventDescriptionSPA] => Llegada a centro de distribución MEXICO D.F. [eventDescriptionENG] => Exit of Container MEXICO D.F. [eventPlaceAcronym] => MEX [eventPlaceName] => MEXICO D.F. [exceptionCode] => [exceptionCodeDescriptionSPA] => [exceptionCodeDescriptionENG] => [exceptionCodeDetails] => ) [1] => stdClass Object ( [eventDateTime] => 29/08/2013 08:32:00 a.m. [eventId] => ECON [eventDescriptionSPA] => En proceso de entrega MEXICO D.F. [eventDescriptionENG] => Entry to LOCAL Container MEXICO D.F. [eventPlaceAcronym] => MEX [eventPlaceName] => MEXICO D.F. [exceptionCode] => [exceptionCodeDescriptionSPA] => [exceptionCodeDescriptionENG] => [exceptionCodeDetails] => ) ) ) ) ) ) )
Pero al ser clases no puedo extraer la informacion que necesito.
Este es mi código:
Gracias por su apoyo.
Saludos.
Estoy programando un Webservice en PHP, consigo el resultado que es el siguiente:
stdClass Object ( [ExecuteQueryResult] => stdClass Object ( [errorCode] => 0 [errorCodeDescriptionSPA] => [errorCodeDescriptionENG] => [trackingData] => stdClass Object ( [TrackingData] => stdClass Object ( [waybill] => 8055241528464720099314 [shortWaybillId] => 3390363075 [serviceId] => 72 [serviceDescriptionSPA] => Servicio Terrestre Prepagado sin credito [serviceDescriptionENG] => Servicio Terrestre Prepagado sin credito [customerNumber] => 5241528 [packageType] => Paquete [additionalInformation] => [statusSPA] => CONFIRMADO [statusENG] => DELIVERED [pickupData] => stdClass Object ( [originAcronym] => MRL [originName] => Moroléon [pickupDateTime] => 07/02/2017 06:36:00 p.m. ) [deliveryData] => stdClass Object ( [destinationAcronym] => CUL [destinationName] => Culiacán [deliveryDateTime] => 13/02/2017 12:22:00 p.m. [zipCode] => 80240 [receiverName] => SOE: MARIA GAXIOLA ) [history] => stdClass Object ( [History] => Array ( [0] => stdClass Object ( [eventDateTime] => 29/08/2013 06:42:00 a.m. [eventId] => SCON [eventDescriptionSPA] => Llegada a centro de distribución MEXICO D.F. [eventDescriptionENG] => Exit of Container MEXICO D.F. [eventPlaceAcronym] => MEX [eventPlaceName] => MEXICO D.F. [exceptionCode] => [exceptionCodeDescriptionSPA] => [exceptionCodeDescriptionENG] => [exceptionCodeDetails] => ) [1] => stdClass Object ( [eventDateTime] => 29/08/2013 08:32:00 a.m. [eventId] => ECON [eventDescriptionSPA] => En proceso de entrega MEXICO D.F. [eventDescriptionENG] => Entry to LOCAL Container MEXICO D.F. [eventPlaceAcronym] => MEX [eventPlaceName] => MEXICO D.F. [exceptionCode] => [exceptionCodeDescriptionSPA] => [exceptionCodeDescriptionENG] => [exceptionCodeDetails] => ) ) ) ) ) ) )
Pero al ser clases no puedo extraer la informacion que necesito.
Este es mi código:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
$client = new SoapClient('https://trackingqa.estafeta.com/Service.asmx?wsdl');
// Arreglo de guías a consultar
$waylbills = array();
$waylbills[0] = '8055241528464720099314';
//$waylbills[1] = '2055241528464720097313';
//$waylbills[2] = '9015205364715620036054';
// Se llena Objeto WaybillRange
$WaybillRange = new StdClass();
$WaybillRange -> initialWaybill = '';
$WaybillRange -> finalWaybill = '';
// Se llena objeto WaybillList, se trata guías de 22 dígitos
$WaybillList = new StdClass();
$WaybillList -> waybillType = 'G';
$WaybillList -> waybills = $waylbills;
// Se llena objeto SearchType, se indica que se trata de una lista de guías
$SearchType = new StdClass();
$SearchType -> waybillRange = $WaybillRange;
$SearchType -> waybillList = $WaybillList;
$SearchType -> type = 'L';
// Se llena objeto HistoryConfiguration, se indica que se requiere toda la historia de las guías
$HistoryConfiguration = new StdClass;
$HistoryConfiguration -> includeHistory = 1;
$HistoryConfiguration -> historyType = 'ALL';
// Se llena objeto Filter, se indica que no se requiere el filtro por estado actual de las guías
$Filter = new StdClass;
$Filter -> filterInformation = 0;
$Filter -> filterType = 'DELIVERED';
// Se llena objeto SearchConfiguration, se indican parámetros adicionales a la búsqueda
$SearchConfiguration = new StdClass();
$SearchConfiguration -> includeDimensions = 0;
$SearchConfiguration -> includeWaybillReplaceData = 0;
$SearchConfiguration -> includeReturnDocumentData = 0;
$SearchConfiguration -> includeMultipleServiceData = 0;
$SearchConfiguration -> includeInternationalData = 0;
$SearchConfiguration -> includeSignature = 0;
$SearchConfiguration -> includeCustomerInfo = 1;
$SearchConfiguration -> historyConfiguration = $HistoryConfiguration;
$SearchConfiguration -> filterType= $Filter;
// Se instancía al método del web service para consulta de guías
$result = $client->ExecuteQuery(array(
'suscriberId'=>25,
'login'=>'Usuario1',
'password'=> '1GCvGIu$',
'searchType' => $SearchType,
'searchConfiguration' => $SearchConfiguration
)
);
//Se imprime resultado obtenido de la consulta al ws
print_r ($result);
?>
Gracias por su apoyo.
Saludos.
Valora esta pregunta


0