root/docs/usc/nautilus/usr2/prod/buoys/perl/xml/nusoap/samples/wsdlclient3.php

Revision 113 (checked in by jcothran, 5 years ago)

example php/perl script to process nerrs cdmo web service data to Xenia database.

Line 
1 <?php
2 /*
3  *    $Id: wsdlclient3.php,v 1.3 2004/06/25 13:21:22 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 $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 $person = array('firstname' => 'Willi', 'age' => 22, 'gender' => 'male');
24 $method = isset($_GET['method']) ? $_GET['method'] : 'function';
25 if ($method == 'function') {
26     $call = 'hello';
27 } elseif ($method == 'instance') {
28     $call = 'hellowsdl2.hello';
29 } elseif ($method == 'class') {
30     $call = 'hellowsdl2..hello';
31 } else {
32     $call = 'hello';
33 }
34 $result = $client->call($call, array('person' => $person));
35 // Check for a fault
36 if ($client->fault) {
37     echo '<h2>Fault</h2><pre>';
38     print_r($result);
39     echo '</pre>';
40 } else {
41     // Check for errors
42     $err = $client->getError();
43     if ($err) {
44         // Display the error
45         echo '<h2>Error</h2><pre>' . $err . '</pre>';
46     } else {
47         // Display the result
48         echo '<h2>Result</h2><pre>';
49         print_r($result);
50         echo '</pre>';
51     }
52 }
53 echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
54 echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
55 echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
56 ?>
57
Note: See TracBrowser for help on using the browser.