Created
September 11, 2017 20:52
-
-
Save wfpaisa/c24228e5cfefd50b959054c6d8a09f21 to your computer and use it in GitHub Desktop.
TCC envios Colombia simple webservice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = "http://clientes.tcc.com.co/servicios/liquidacionacuerdos.asmx?wsdl"; | |
/* Initialize webservice TCC WSDL */ | |
$client = new SoapClient($url); | |
/* Get TCC functions and types functions */ | |
// print_r($client->__getFunctions()); | |
// print_r($client->__getTypes()); | |
/* Parameters for the TCC request */ | |
$params = array( | |
"Clave" => "XXX", | |
"Despacho" => array( | |
"cuenta" => "XXX", | |
"idciudadorigen" => "5001000", // Medellin | |
"idciudaddestino" => "11001000", //Bogota | |
"valormercancia" => "100", | |
"unidadnegocio"=> "2", | |
"recogida" => "0", //indica si la mercancía se recoge en origen True=si, False= no | |
"traecd" => "0", //Indica si el cliente lleva el paquete hasta TCC True=si, False=no | |
"recogecd" => "0",//Indica si el remitente recoge el paquete en TCC True=si, False=no | |
"boomerang" => "0", | |
"unidades" => array( | |
"unidad2"=>array( | |
"tipoempaque"=>"1", | |
"unidades"=>"1", | |
"peso"=>"1", // 1 kilo | |
"volumen"=>"1", //pasar a metros= alto * largo * ancho * 400 | |
"alto"=>"10", //cm | |
"largo"=>"10",//cm | |
"ancho"=>"10",//cm | |
) | |
) | |
), | |
"Liquidacion"=>"0", | |
"Respuesta"=>"0", | |
"Mensaje"=>"0", | |
); | |
/* Invoke webservice method */ | |
//$responseCity = $client->__soapCall("consultarMaestroCiudades", array($params)); | |
$response = $client->__soapCall("LiquidaDespacho2", array($params)); | |
/* Response object to array to XML */ | |
$response1 = get_object_vars($response); | |
print_r($response1['Liquidacion']); | |
$response2 = new SimpleXMLElement($response1['Liquidacion']); | |
echo "\n"; | |
print_r(round((float)$response2->valortotal / 100) *100); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment