Commit | Line | Data |
---|---|---|
696f20d5 MS |
1 | <?php |
2 | /* | |
3 | * $Id: wsdlclient8.php,v 1.2 2007/11/06 14:49:10 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 | $address = array( | |
27 | 'AddressLine' => '563 Park Avenue', | |
28 | 'PrimaryCity' => 'New York', | |
29 | 'SecondaryCity' => 'Brooklyn', | |
30 | 'Subdivision' => '', | |
31 | 'PostalCode' => '', | |
32 | 'CountryRegion' => 'US', | |
33 | 'FormattedAddress' => '' | |
34 | ); | |
35 | $findRange = array( | |
36 | 'StartIndex' => 0, | |
37 | 'Count' => 10 | |
38 | ); | |
39 | $findResultMask = 'AddressFlag'; | |
40 | $findOptions = array( | |
41 | 'Range' => $findRange, | |
42 | 'SearchContext' => 1, | |
43 | 'ResultMask' => $findResultMask, | |
44 | 'ThresholdScore' => 0.85 | |
45 | ); | |
46 | $findAddressSpecification = array( | |
47 | 'DataSourceName' => 'MapPoint.NA', | |
48 | 'InputAddress' => $address, | |
49 | 'Options' => $findOptions | |
50 | ); | |
51 | $findAddress = array('specification' => $findAddressSpecification); | |
52 | $result = $client->call('FindAddress', array('parameters' => $findAddress)); | |
53 | // Check for a fault | |
54 | if ($client->fault) { | |
55 | echo '<h2>Fault</h2><pre>'; | |
56 | print_r($result); | |
57 | echo '</pre>'; | |
58 | } else { | |
59 | // Check for errors | |
60 | $err = $client->getError(); | |
61 | if ($err) { | |
62 | // Display the error | |
63 | echo '<h2>Error</h2><pre>' . $err . '</pre>'; | |
64 | } else { | |
65 | // Display the result | |
66 | echo '<h2>Result</h2><pre>'; | |
67 | print_r($result); | |
68 | echo '</pre>'; | |
69 | } | |
70 | } | |
71 | echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>'; | |
72 | echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>'; | |
73 | echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>'; | |
74 | ?> |