Removed php_test.
[siap.git] / nusoap / samples / wsdlclient9.php
1 <?php
2 /*
3  *      $Id: wsdlclient9.php,v 1.2 2007/11/06 14:50:06 snichol Exp $
4  *
5  *      WSDL client sample.
6  *
7  *      Service: WSDL
8  *      Payload: document/literal
9  *      Transport: http
10  *      Authentication: digest
11  */
12 require_once('../lib/nusoap.php');
13 $proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
14 $proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
15 $proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
16 $proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
17 echo 'You must set your username and password in the source';
18 exit();
19 $client = new nusoap_client("http://staging.mappoint.net/standard-30/mappoint.wsdl", 'wsdl',
20                                                 $proxyhost, $proxyport, $proxyusername, $proxypassword);
21 $err = $client->getError();
22 if ($err) {
23         echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
24 }
25 $client->setCredentials($username, $password, 'digest');
26 $client->useHTTPPersistentConnection();
27 $view = array(
28         'Height' => 200,
29         'Width' => 300,
30         'CenterPoint' => array(
31                 'Latitude' => 40,
32                 'Longitude' => -120
33         )
34 );
35 $myViews[] = new soapval('MapView', 'ViewByHeightWidth', $view, false, 'http://s.mappoint.net/mappoint-30/');
36 $mapSpec = array(
37         'DataSourceName' => "MapPoint.NA",
38         'Views' => array('MapView' => $myViews)
39 );
40 $map = array('specification' => $mapSpec);
41 $result = $client->call('GetMap', array('parameters' => $map));
42 // Check for a fault
43 if ($client->fault) {
44         echo '<h2>Fault</h2><pre>';
45         print_r($result);
46         echo '</pre>';
47 } else {
48         // Check for errors
49         $err = $client->getError();
50         if ($err) {
51                 // Display the error
52                 echo '<h2>Error</h2><pre>' . $err . '</pre>';
53         } else {
54                 // Display the result
55                 echo '<h2>Result</h2><pre>';
56                 print_r($result);
57                 echo '</pre>';
58         }
59 }
60 echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
61 echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
62 echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
63 ?>