Example #1
0
 public function requestDebug()
 {
     echo "Last Request:\n\n";
     echo $this->client->__getLastRequestHeaders() . "\n\n";
     echo self::tidyit($this->client->__getLastRequest()) . "\n\n";
     echo $this->client->__getLastResponseHeaders() . "\n\n";
     echo self::tidyit($this->client->__getLastResponse()) . "\n";
 }
Example #2
0
 private function testEnv(array $functions, $url, OutputInterface $output)
 {
     $soapClient = new \SoapClient($url, array('cache_wsdl' => 0, 'trace' => 1, 'soap_version' => SOAP_1_1));
     foreach ($functions as $function => $parameters) {
         $output->writeln('Test de la fonction soap <comment>' . $function . '</comment>');
         $output->writeln('Parameters : ');
         dump($parameters);
         if (!array_key_exists('methodCall', $this->config) || $this->config['methodCall'] == 'soapCall') {
             $result = $soapClient->__soapCall($function, $parameters);
         } else {
             $result = $soapClient->{$function}($parameters);
         }
         $headers = $soapClient->__getLastResponseHeaders();
         if ($output->isDebug()) {
             $output->writeln('Entete de la reponse : ');
             dump($headers);
         }
         if (false === ($site = $this->getSiteHeader($headers))) {
             throw new \Exception('Site Header introuvable dans la réponse.', 1);
         }
         $output->writeln('Serveur ayant repondu : <info>' . $site . '</info>');
         $output->writeln('Reponse : ');
         dump($result);
         if ($output->isDebug()) {
             dump($soapClient->__getLastResponse());
         }
     }
 }
Example #3
0
 /**
  * Retrieve response headers (as string)
  *
  * @return string
  */
 public function getLastResponseHeaders()
 {
     if ($this->_soapClient !== null) {
         return $this->_soapClient->__getLastResponseHeaders();
     }
     return '';
 }
Example #4
0
 /**
  * Dump Client response and request messages
  *
  * @param   SoapClient  $client  Client instance
  *
  * @return void
  */
 private function dumpSoapMessages($client)
 {
     echo '<br />$client->__getLastRequest():<br />';
     var_dump($client->__getLastRequest());
     echo '<br />$client->__getLastRequestHeaders():<br />';
     var_dump($client->__getLastRequestHeaders());
     echo '<br />$client->__getLastResponse():<br />';
     var_dump($client->__getLastResponse());
     echo '<br />$client->__getLastResponseHeaders():<br />';
     var_dump($client->__getLastResponseHeaders());
 }
Example #5
0
 public function run($reportName, $formatType = 'PDF', $reportParams = null, $saveFile = false)
 {
     $client = new \SoapClient($this->jasperServer->getWsdl(), array('login' => $this->jasperServer->getUsername(), 'password' => $this->jasperServer->getPassword(), "trace" => 1, "exceptions" => 0));
     $client->runReport($this->_requestMock($reportName, $formatType, $reportParams));
     preg_match('/boundary="(.*?)"/', $client->__getLastResponseHeaders(), $gotcha);
     $bound = $gotcha[1];
     $invokeReturnPart = explode($bound, $client->__getLastResponse());
     $output = substr($invokeReturnPart[2], strpos($invokeReturnPart[2], '<report>') + 9);
     $content = trim(str_replace("\n--", "", $output));
     if ($saveFile === true) {
         $filename = $this->jasperServer->getPathToSave() . DIRECTORY_SEPARATOR . 'generate_report_at_' . time() . ".{$formatType}";
         file_put_contents($filename, $content);
         return $filename;
     } else {
         return $content;
     }
 }
Example #6
0
 /**
  * @param array $data
  * @param bool|false $returnXml
  *
  * @return \stdClass|array|string
  *
  * @throws WebGateException
  */
 public function send($data, $returnXml = false)
 {
     try {
         $options = ['trace' => true, 'exceptions' => true, 'connection_timeout' => $this->connectionTimeout];
         if (!empty($this->login)) {
             $options['login'] = $this->login;
             $options['password'] = $this->password;
         }
         if (0) {
             $options['location'] = '';
             $options['uri'] = '';
             $wsdl = null;
         } else {
             $wsdl = $this->wsdlPath;
         }
         $client = new \SoapClient($wsdl, $options);
         ini_set("default_socket_timeout", $this->connectionTimeout);
         $response = $client->__soapCall($this->methodName, array('params' => $data));
         $this->logger->addDebug('Response XML: ' . PHP_EOL . $client->__getLastResponse());
         $this->logger->addDebug('Response JSON: ' . PHP_EOL . json_encode($response));
         return $returnXml ? $client->__getLastResponse() : $response;
     } catch (\SoapFault $e) {
         if (isset($client)) {
             $this->logger->addDebug(PHP_EOL . __METHOD__ . ':');
             $this->logger->addDebug('Request Headers: ' . $client->__getLastRequestHeaders());
             $this->logger->addDebug('Request: ' . $client->__getLastRequest());
             $this->logger->addDebug('Response Headers: ' . $client->__getLastResponseHeaders());
             $this->logger->addDebug('Response: ' . PHP_EOL . $client->__getLastResponse());
         }
         if ($e->getCode()) {
             $code = $e->getCode();
         } else {
             $code = isset($e->faultcode) && is_numeric($e->faultcode) ? $e->faultcode : 500;
         }
         $this->logger->addCritical(PHP_EOL . __METHOD__ . sprintf('[%s/%s] %s', $e->getCode(), $code, $e->getMessage()));
         throw new WebGateException($e->getMessage(), $code, $e);
     }
 }
Example #7
0
<?php

$client = new SoapClient("http://sparesprit.de/sprit.wsdl", array('location' => "http://sparesprit.de/server.php", 'uri' => "http://localhost", 'trace' => 1));
try {
    $result = $client->__soapCall("getCoordsByTown", array("town" => "Leipzig"));
    //echo $result;
    echo gettype($result);
} catch (Exception $e) {
    echo 'Exception abgefangen: ', $e->getMessage(), "\n";
}
echo "\nReturning value of __soapCall() call: " . $return;
echo "\nDumping request headers:\n" . $client->__getLastRequestHeaders();
echo "\nDumping request:\n" . $client->__getLastRequest();
echo "\nDumping response headers:\n" . $client->__getLastResponseHeaders();
echo "\nDumping response:\n" . $client->__getLastResponse();
 /**
  * Submits an API request through the iATS SOAP API Toolkit.
  *
  * @param $request
  *   The request object or array containing the parameters of the requested services.
  *
  * @return
  *   The response object from the API with properties pertinent to the requested
  *     services.
  */
 function request($credentials, $payment)
 {
     // Attempt the SOAP request and log the exception on failure.
     $method = $this->method['method'];
     if (empty($method)) {
         dsm($this->method);
         return FALSE;
     }
     // do some massaging of parameters for badly behaving iATS methods ($method is now the iATS method, not our internal key)
     switch ($method) {
         case 'CreateCreditCardCustomerCode':
         case 'UpdateCreditCardCustomerCode':
             $dummy_date = date('c', time());
             // now
             foreach (array('beginDate', 'endDate') as $key) {
                 if (empty($request_params[$key])) {
                     $request_params[$key] = $dummy_date;
                 }
             }
             break;
     }
     $message = $this->method['message'];
     $response = $this->method['response'];
     // always log requests to my own table, start by making a copy of the original request
     // note: this is different from the drupal watchdog logging that only happens if userframework logging and debug are enabled
     if (!empty($payment['invoiceNum'])) {
         $logged_request = $payment;
         // mask the cc numbers
         $this->mask($logged_request);
         // log: ip, invoiceNum, , cc, total, date
         // dpm($logged_request);
         $cc = isset($logged_request['creditCardNum']) ? $logged_request['creditCardNum'] : (isset($logged_request['ccNum']) ? $logged_request['ccNum'] : '');
         $ip = $logged_request['customerIPAddress'];
         $query_params = array(1 => array($logged_request['invoiceNum'], 'String'), 2 => array($ip, 'String'), 3 => array(substr($cc, -4), 'String'), 4 => array('', 'String'), 5 => array($logged_request['total'], 'String'));
         CRM_Core_DAO::executeQuery("INSERT INTO civicrm_iats_request_log\n        (invoice_num, ip, cc, customer_code, total, request_datetime) VALUES (%1, %2, %3, %4, %5, NOW())", $query_params);
         if (!$this->is_ipv4($ip)) {
             $payment['customerIPAddress'] = substr($ip, 0, 30);
         }
         // save the invoiceNum so I can log it for the response
         $this->invoiceNum = $logged_request['invoiceNum'];
     }
     // the agent user and password only get put in here so they don't end up in a log above
     try {
         /* until iATS fixes it's box verify, we need to have trace on to make the hack below work */
         $soapClient = new SoapClient($this->_wsdl_url, array('trace' => 1, 'soap_version' => SOAP_1_2));
         /* build the request manually as per the iATS docs */
         $xml = '<' . $message . ' xmlns="' . $this->_wsdl_url_ns . '">';
         $request = array_merge($this->request, (array) $credentials, (array) $payment);
         // Pass CiviCRM tag + version to iATS
         $request['comment'] = 'CiviCRM: ' . CRM_Utils_System::version() . ' + ' . 'iATS Extension: ' . $this->iats_extension_version();
         $tags = !empty($this->_tag_order) ? $this->_tag_order : array_keys($request);
         foreach ($tags as $k) {
             if (isset($request[$k])) {
                 $xml .= '<' . $k . '>' . $request[$k] . '</' . $k . '>';
             }
         }
         $xml .= '</' . $message . '>';
         if (!empty($this->options['log'])) {
             watchdog('civicrm_iatspayments_com', 'Method info: !method', array('!method' => $method), WATCHDOG_NOTICE);
             watchdog('civicrm_iatspayments_com', 'XML: !xml', array('!xml' => $xml), WATCHDOG_NOTICE);
         }
         $soapRequest = new SoapVar($xml, XSD_ANYXML);
         if (!empty($this->options['log'])) {
             watchdog('civicrm_iatspayments_com', 'Request !request', array('!request' => print_r($soapRequest, TRUE)), WATCHDOG_NOTICE);
         }
         $soapResponse = $soapClient->{$method}($soapRequest);
         if (!empty($this->options['log']) && !empty($this->options['debug'])) {
             $request_log = "\n HEADER:\n";
             $request_log .= $soapClient->__getLastRequestHeaders();
             $request_log .= "\n BODY:\n";
             $request_log .= $soapClient->__getLastRequest();
             $request_log .= "\n BODYEND:\n";
             watchdog('civicrm_iatspayments_com', 'Request: !request', array('!request' => '<pre>' . $request_log . '</pre>'), WATCHDOG_NOTICE);
             $response_log = "\n HEADER:\n";
             $response_log .= $soapClient->__getLastResponseHeaders();
             $response_log .= "\n BODY:\n";
             $response_log .= $soapClient->__getLastResponse();
             $response_log .= "\n BODYEND:\n";
             watchdog('civicrm_iatspayments_com', 'Response: !response', array('!response' => '<pre>' . $response_log . '</pre>'), WATCHDOG_NOTICE);
         }
     } catch (SoapFault $exception) {
         if (!empty($this->options['log'])) {
             watchdog('civicrm_iatspayments_com', 'SoapFault: !exception', array('!exception' => '<pre>' . print_r($exception, TRUE) . '</pre>'), WATCHDOG_ERROR);
             $response_log = "\n HEADER:\n";
             $response_log .= $soapClient->__getLastResponseHeaders();
             $response_log .= "\n BODY:\n";
             $response_log .= $soapClient->__getLastResponse();
             $response_log .= "\n BODYEND:\n";
             watchdog('civicrm_iatspayments_com', 'Raw Response: !response', array('!response' => '<pre>' . $response_log . '</pre>'), WATCHDOG_NOTICE);
         }
         return FALSE;
     }
     // Log the response if specified.
     if (!empty($this->options['log'])) {
         watchdog('civicrm_iatspayments_com', 'iATS SOAP response: !request', array('!request' => '<pre>' . print_r($soapResponse, TRUE) . '</pre>', WATCHDOG_DEBUG));
     }
     if (isset($soapResponse->{$response}->any)) {
         $xml_response = $soapResponse->{$response}->any;
         return new SimpleXMLElement($xml_response);
     } else {
         // deal with bad iats soap, this will only work if trace (debug) is on for now
         $hack = new stdClass();
         $hack->FILE = strip_tags($soapClient->__getLastResponse());
         return $hack;
     }
 }
 /**
  * returns last response headers
  *
  * @return string
  */
 public function getLastResponseHeaders()
 {
     return $this->soapClient->__getLastResponseHeaders();
 }
Example #10
0
 /** sends a SOAP request to a FedEx server. see what happens */
 function send_fedex_query($request)
 {
     if ($this->debug) {
         $log = "\n\n==\n" . get_class($this) . "::send_fedex_query()\n" . date('r');
         $log .= "\nIP: " . $_SERVER['REMOTE_ADDR'];
         error_log($log, 3, $this->debug_log);
     }
     $wsdl = dirname(__FILE__) . '/' . $this->_path_to_wsdl;
     if ($this->test_mode) {
         // testing version wsql hacked in, has a one-line difference
         $wsdl = preg_replace('/\\.wsdl$/', '-testing.wsdl', $wsdl);
     }
     $client = new SoapClient($wsdl, array('trace' => $this->debug));
     // http://us3.php.net/manual/en/ref.soap.php
     $quotes = array();
     try {
         $response = $client->getRates($request);
     } catch (SoapFault $e) {
         if ($this->debug) {
             $log = "\n\n==== EXCEPTION CAUGHT : SoapFault Exception ====\n";
             $log .= "====REQUEST====: \n" . $client->__getLastRequestHeaders() . "\n";
             $log .= $client->__getLastRequest() . "\n\n";
             $log .= "====RESPONSE===: \n" . $client->__getLastResponseHeaders() . "\n";
             $log .= $client->__getLastResponse() . "\n\n";
             error_log($log, 3, $this->debug_log);
         }
         return $this->raiseError($e->getMessage());
     }
     if ($this->debug) {
         $log = "\n====REQUEST==== \n" . $client->__getLastRequest() . "\n\n";
         error_log($log, 3, $this->debug_log);
         error_log("\nHighestSeverity: {$response->HighestSeverity}\n", 3, $this->debug_log);
         $log = "====RESPONSE===: \n" . serialize($response) . "\n\n";
         error_log($log, 3, $this->debug_log);
     }
     if ($response->HighestSeverity == 'SUCCESS') {
         foreach ($response->RateReplyDetails as $rateReply) {
             if (!is_object($rateReply) || !isset($rateReply->ServiceType)) {
                 continue;
             }
             $service = $rateReply->ServiceType;
             foreach ($rateReply->RatedShipmentDetails as $detail) {
                 $last_rate = null;
                 if (isset($detail->ShipmentRateDetail)) {
                     $rate = $detail->ShipmentRateDetail->TotalNetFedExCharge->Amount;
                     /* fedex returns multiple rate detail objects for each method, but they are always identical (maybe) */
                     if (!empty($last_rate) and $rate != $last_rate) {
                         $msg = "got different rates for the same shipping method {$service}";
                         trigger_error($msg, E_USER_WARNING);
                         if ($this->debug) {
                             error_log("{$msg}\n", 3, $this->debug_log);
                         }
                     }
                     $last_rate = $rate;
                 }
             }
             $quotes[$service] = $rate;
         }
         if (empty($quotes)) {
             $err = "No ship methods are available for this destination at this time. Please try again.";
             if ($this->debug) {
                 error_log("ERROR: {$err}\n", 3, $this->debug_log);
             }
             return $this->raiseError($err);
         }
         return $quotes;
     } else {
         if (is_object($response->Notifications)) {
             if ($response->Notifications->Code == 556) {
                 $err = "The Address or Postal/ZIP code was not valid.";
             } else {
                 $err = $response->Notifications->Severity . ': ' . $response->Notifications->Message . ' ';
             }
         } elseif (is_array($response->Notifications)) {
             foreach ($response->Notifications as $notification) {
                 $err .= $notification->Message . ' ';
             }
         }
         if ($this->debug) {
             error_log("Notification: {$err}\n", 3, $this->debug_log);
         }
         return $this->raiseError($err);
     }
 }
Example #11
0
require_once 'helpers.inc.php';
spl_autoload_register(function ($className) {
    require_once "classes/{$className}" . '.php';
});
$conn = dbConnect();
$sql = 'INSERT INTO requests (id, startdate, enddate, request_time, result, body, header) VALUES (NULL,?,?,?,?,?,?)';
try {
    $client = new SoapClient('http://82.138.16.126:8888/TaxiPublic/Service.svc?wsdl', array("trace" => 1));
    $start = date('Y-m-d H:i:s');
    $startmicro = microtime(true);
    $result = $client->GetTaxiInfos(array('request' => array('RegNum' => 'лЋлю33377')));
    $endmicro = microtime(true);
    $end = date('Y-m-d H:i:s');
    $time = $endmicro - $startmicro;
    $response = $client->__getLastResponse();
    $response_head = $client->__getLastResponseHeaders();
    $arr = parseXmlResponse($response);
    $compare_result = Taxi::compareWithPattern($arr[0]);
    $stmt = $conn->prepare($sql);
    if ($compare_result) {
        $stmt->execute(array($start, $end, $time, 1, NULL, NULL));
    } else {
        $stmt->execute(array($start, $end, $time, 0, $response, $response_head));
    }
    if ($stmt->rowCount()) {
        echo 'SQL INSERT SUCCESS';
        echo '<br/>';
    }
} catch (SoapFault $fault) {
    trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
 /**
  * Invoke method call
  *
  * @param   string method name
  * @param   var vars
  * @return  var answer
  * @throws  webservices.soap.SOAPFaultException
  */
 public function invoke()
 {
     $args = func_get_args();
     $method = array_shift($args);
     $options = ['encoding' => $this->getEncoding(), 'exceptions' => 0, 'trace' => $this->cat != null, 'user_agent' => 'XP-Framework/' . get_class($this)];
     if (null !== $this->ctimeout) {
         $options['connection_timeout'] = $this->ctimeout;
     }
     if (null !== $this->timeout) {
         // NOOP
     }
     if (null !== $this->endpoint->getUser()) {
         $options['login'] = $this->endpoint->getUser();
     }
     if (null !== $this->endpoint->getPassword()) {
         $options['password'] = $this->endpoint->getPassword();
     }
     if (sizeof($this->map)) {
         $options['classmap'] = $this->map;
     }
     $this->version && ($options['soap_version'] = $this->version);
     $this->location && ($options['location'] = $this->location);
     if ($this->wsdl) {
         $client = new \SoapClient($this->endpoint->getURL(), $options);
     } else {
         // Do not overwrite location if already set from outside
         isset($options['location']) || ($options['location'] = $this->endpoint->getURL());
         // Assert we have a uri
         if (!$this->uri) {
             throw new \lang\IllegalArgumentException('SOAP uri required in non-wsdl mode.');
         }
         $options['uri'] = $this->uri;
         $options['style'] = $this->getStyle();
         $options['use'] = $this->getSoapEncoding();
         $client = new \SoapClient(null, $options);
     }
     // Take care of wrapping XP SOAP types into respective ext/soap value objects
     $result = $client->__soapCall($method, $this->checkParams($args));
     $this->cat && $this->cat->debug('>>>', $client->__getLastRequestHeaders(), $client->__getLastRequest());
     $this->cat && $this->cat->debug('<<<', $client->__getLastResponseHeaders(), $client->__getLastResponse());
     if (is_soap_fault($result)) {
         throw new SOAPFaultException(new CommonSoapFault($result->faultcode, $result->faultstring));
     }
     return $result;
 }
Example #13
0
 function __doRequest($request, $location, $action, $version, $one_way)
 {
     // FIXME: allow sending attachments
     $this->attachments = array();
     $response = parent::__doRequest($request, $location, $action, $version, $one_way);
     $headers = parent::__getLastResponseHeaders();
     // if it is a multipart response, split the parts, return the main xml
     // part, and add the attachments
     if (strpos($headers, 'Content-Type: multipart/related')) {
         preg_match('/start="([^"]*)";.*boundary="([^"]*)"/', $headers, $matches);
         $start = $matches[1];
         $boundary = $matches[2];
         $parts = explode('--' . $boundary, $response);
         foreach ($parts as $part) {
             $pieces = explode("\r\n\r\n", $part, 2);
             if (count($pieces) != 2) {
                 // skip "empty" parts
                 continue;
             }
             $header = $pieces[0];
             $body = $pieces[1];
             preg_match('/Content-Id: (.*)$/m', $header, $matches);
             if ($matches[1] == $start) {
                 $response = $body;
             } else {
                 $this->attachments[] = $pieces;
             }
         }
     }
     return $response;
 }
 /**
  * @return array
  */
 public function getLastRequest()
 {
     return array('request' => array('header' => $this->soapClient->__getLastRequestHeaders(), 'body' => $this->soapClient->__getLastRequest()), 'response' => array('header' => $this->soapClient->__getLastResponseHeaders(), 'body' => $this->soapClient->__getLastResponse()));
 }
Example #15
0
 /**
  * Get last request headers as array
  *
  * @return array
  */
 protected function getLastResponseHeaders()
 {
     return ParserRegistry::getInstance()->getParser('message')->parseResponse($this->client->__getLastResponseHeaders());
 }
Example #16
0
	$headers[] = new SoapHeader('http://www.topcall.com/2005/solution.wsdl', 
                            'SendSimpleMessage',
                            array('Service'=>'',  'Number' => '1234', 'Subject'=>'', 'Text' => '121212'));
    
    */
    try {
    	
		  
    $result = $client->SendSimpleMessage(array('Service'=>"test string",'Number'=> "1234",'Subject'=>"234234",'Text'=>"dfgdfgdfg"));
    //$result = $client->__soapCall("SendSimpleMessage", array('bbb', '12345','aaa' ,'tresctresce'));
    echo "Response:\n" . $client->__getLastRequest() . "\n";
    
    echo "Response:\n" . $client->__getLastRequestHeaders() . "\n";
        
    echo "Response:\n" . $client->__getLastResponseHeaders() . "\n";
    echo "Response:\n" . $client->__getLastResponse();
    print_r($result);
    }
    catch (SoapFault $soapFault) { 
	var_dump($soapFault);
    echo "Response:\n" . $client->__getLastRequest() . "\n";
    
    echo "Response:\n" . $client->__getLastRequestHeaders() . "\n";
        
    echo "Response:\n" . $client->__getLastResponseHeaders() . "\n";
    
    var_dump($client->__getFunctions());
    
  }
echo "\n</pre>\n"; 
Example #17
0
 /**
  * Execute queryMore() API call.
  *
  * @return result object
  *
  * @throws ZuoraFault
  */
 public function queryMore($zoql)
 {
     $query = array("queryLocator" => $zoql);
     $queryWrapper = array("queryMore" => $query);
     try {
         $result = $this->_client->__soapCall("queryMore", $queryWrapper, null, $this->_header);
     } catch (SoapFault $e) {
         throw new ZuoraFault('ERROR in ' . __METHOD__, $e, $this->_client->__getLastRequestHeaders(), $this->_client->__getLastRequest(), $this->_client->__getLastResponseHeaders(), $this->_client->__getLastResponse());
     }
     return $result;
 }
Example #18
0
    $response = array();
    //$response['helloResponse'] = $client->getHello();
    $response['goodbyeResponse'] = $client->getGoodbye();
    //print_r($response);
} catch (SoapFault $fault) {
    echo "<pre style='margin:2em;color:red'>";
    print_r($fault);
    //echo 'Soap Error - faultcode: '.$fault->faultcode.' faultstring: '.$fault->faultstring;
    echo "</pre>";
}
echo '<hr>';
echo "<pre style='margin:2em;color:black;'>";
echo 'Reponse <br>';
var_dump($response);
echo '</pre>';
echo '<hr>';
echo "<pre style='margin:2em;font-family:\"Courier New\",Courier,monospace;line-height:1em'>";
echo 'Soap Client trace' . "\n";
echo "REQUEST:" . $client->__getLastRequest() . "\n";
echo "RESPONSE:" . $client->__getLastResponse() . "\n";
echo "REQUEST HEADERS:" . $client->__getLastRequestHeaders();
echo "RESPONSE HEADERS:" . $client->__getLastResponseHeaders();
echo 'Debug Report <br>';
echo '</pre>';
//Notice: Array to string conversion in F:\bit5411\apps\gjsoap\htdocs\includes\gj_utility.inc.php on line 341
//fix above
generateDebugReport('browser', get_defined_vars());
?>


 /**
  * @link http://php.net/manual/en/soapclient.getlastresponseheaders.php
  *
  * @return string
  */
 public function __getLastResponseHeaders()
 {
     return parent::__getLastResponseHeaders();
 }
								<baseModel>' . $baseModel . '</baseModel>
								<subModel>' . $subModel . '</subModel>
								</request>', XSD_ANYXML);
    $tag['getDriversCabOptions'] = $request;
    $prerequest = new SoapVar($tag, SOAP_ENC_OBJECT);
    $getCardata = array($prerequest);
    // Set the previously stored cookie for the request
    foreach ($keys as $k) {
        $wsdlDatei_eval2->__setCookie($k, $requestCookies[$k]);
    }
    $objConversions = $wsdlDatei_eval2->__soapCall('getDriversCabOptions', $getCardata);
    if (is_soap_fault($objConversions)) {
        trigger_error("SOAP Fault: (faultcode: {$objConversions->faultcode}, faultstring: {$objConversions->faultstring})", E_USER_ERROR);
        print_r("REQUEST-Header2: " . $wsdlDatei_eval2->__getLastRequestHeaders() . "");
        print_r("Last-REQUEST2: " . $wsdlDatei_eval2->__getLastRequest() . "");
        print_r("Last-RESPONSE2: " . $wsdlDatei_eval2->__getLastResponseHeaders() . "");
    }
    echo "<pre>";
    print_r("REQUEST-Header2: " . $wsdlDatei_eval2->__getLastRequestHeaders() . "");
    print_r("Last-REQUEST2: " . $wsdlDatei_eval2->__getLastRequest() . "");
    print_r("Last-RESPONSE2: " . $wsdlDatei_eval2->__getLastResponseHeaders() . "");
    print_r($objConversions);
    echo "</pre>";
    $wsdlDatei_eval->doLogout();
} catch (SoapFault $e) {
    $errorHandled = false;
    $wsdlDatei_eval->doLogout();
    echo "<pre>";
    print_r($e);
    echo "</pre>";
    $exception = $e->getMessage();
Example #21
0
<?php

$options = array('uri' => 'http://api.local/ws', 'location' => 'http://api.local/ws/index.php', 'trace' => 1);
$x = new stdClass();
$x->username = '******';
$x->password = '******';
$header = new SoapHeader('http://api.local/ws', 'AuthenticationHeader', $x);
$client = new SoapClient(NULL, $options);
$client->__setSoapHeaders(array($header));
try {
    $books = $client->getAvailableBooks();
    print_r($books);
    $books = $client->addBook('La storia infinita');
    print_r($books);
} catch (SoapFault $e) {
    echo $e->getMessage();
}
echo $client->__getLastRequestHeaders();
echo "\n\n";
echo $client->__getLastRequest();
echo "\n\n";
echo $client->__getLastResponseHeaders();
echo "\n\n";
echo $client->__getLastResponse();