ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
wsdlclient5.php
Go to the documentation of this file.
1 <?php
2 /*
3  * $Id: wsdlclient5.php,v 1.4 2007/11/06 14:49:10 snichol Exp $
4  *
5  * WSDL client sample.
6  *
7  * Service: WSDL
8  * Payload: rpc/encoded
9  * Transport: http
10  * Authentication: none
11  */
12 require_once('../lib/nusoap.php');
13 require_once('../lib/class.wsdlcache.php');
14 $proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
15 $proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
16 $proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
17 $proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
18 $useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';
19 
20 $cache = new wsdlcache('.', 60);
21 $wsdl = $cache->get('http://www.xmethods.net/sd/2001/BNQuoteService.wsdl');
22 if (is_null($wsdl)) {
23  $wsdl = new wsdl('http://www.xmethods.net/sd/2001/BNQuoteService.wsdl',
25  0, 30, null, $useCURL);
26  $err = $wsdl->getError();
27  if ($err) {
28  echo '<h2>WSDL Constructor error (Expect - 404 Not Found)</h2><pre>' . $err . '</pre>';
29  echo '<h2>Debug</h2><pre>' . htmlspecialchars($wsdl->getDebug(), ENT_QUOTES) . '</pre>';
30  exit();
31  }
32  $cache->put($wsdl);
33 } else {
34  $wsdl->clearDebug();
35  $wsdl->debug('Retrieved from cache');
36 }
37 $client = new nusoap_client($wsdl, 'wsdl',
39 $err = $client->getError();
40 if ($err) {
41  echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
42  exit();
43 }
44 $client->setUseCurl($useCURL);
45 $params = array('isbn' => '0060188782');
46 $result = $client->call('getPrice', $params);
47 // Check for a fault
48 if ($client->fault) {
49  echo '<h2>Fault</h2><pre>';
50  print_r($result);
51  echo '</pre>';
52 } else {
53  // Check for errors
54  $err = $client->getError();
55  if ($err) {
56  // Display the error
57  echo '<h2>Error</h2><pre>' . $err . '</pre>';
58  } else {
59  // Display the result
60  echo '<h2>Result</h2><pre>';
61  print_r($result);
62  echo '</pre>';
63  }
64 }
65 echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
66 echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
67 echo '<h2>Cache Debug</h2><pre>' . htmlspecialchars($cache->getDebug(), ENT_QUOTES) . '</pre>';
68 echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
69 ?>