Commit | Line | Data |
---|---|---|
1c21f490 MS |
1 | <?php |
2 | /* | |
3 | * $Id: wsdlclient3b.php,v 1.1 2004/06/15 15:38:29 snichol Exp $ | |
4 | * | |
5 | * WSDL client sample. | |
6 | * | |
7 | * Service: WSDL | |
8 | * Payload: rpc/encoded (params as an XML string; cf. wsdlclient3.php) | |
9 | * Transport: http | |
10 | * Authentication: none | |
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 | $client = new soapclient('http://www.scottnichol.com/samples/hellowsdl2.php?wsdl', true, | |
18 | $proxyhost, $proxyport, $proxyusername, $proxypassword); | |
19 | $err = $client->getError(); | |
20 | if ($err) { | |
21 | echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; | |
22 | } | |
23 | $params = '<person xsi:type="tns:Person"><firstname xsi:type="xsd:string">Willi</firstname><age xsi:type="xsd:int">22</age><gender xsi:type="xsd:string">male</gender></person>'; | |
24 | $result = $client->call('hello', $params); | |
25 | // Check for a fault | |
26 | if ($client->fault) { | |
27 | echo '<h2>Fault</h2><pre>'; | |
28 | print_r($result); | |
29 | echo '</pre>'; | |
30 | } else { | |
31 | // Check for errors | |
32 | $err = $client->getError(); | |
33 | if ($err) { | |
34 | // Display the error | |
35 | echo '<h2>Error</h2><pre>' . $err . '</pre>'; | |
36 | } else { | |
37 | // Display the result | |
38 | echo '<h2>Result</h2><pre>'; | |
39 | print_r($result); | |
40 | echo '</pre>'; | |
41 | } | |
42 | } | |
43 | echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>'; | |
44 | echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>'; | |
45 | echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>'; | |
46 | ?> |