Exemplo n.º 1
0
 /**
  * Retrieves the information of a shipment given a waybill number
  *
  * return array
  */
 public function getDetail()
 {
     $exceptionFlag = false;
     // initialize SOAP client
     $client = new SoapClient($this->_url, array());
     $funcs = $client->__getFunctions();
     // initialize SOAP header
     $headerbody = array(self::USER_TOKEN => $this->_userToken);
     $header = new SoapHeader($this->_header, self::AUTH_HEADER, $headerbody);
     $client->__setSoapHeaders($header);
     // execute SOAP method
     try {
         $result = $client->Get(array(self::WAY_BILL_NO => $this->_wayBill));
     } catch (SoapFault $soapfault) {
         $this->_exceptionFlag = true;
         $exception = $soapfault->getMessage();
         preg_match_all('/: (.*?). at/s', $exception, $error, PREG_SET_ORDER);
         //Print error
         return $error[0][1];
     }
     return $result->GetResult;
 }