root/docs/usc/nautilus/usr2/prod/buoys/perl/xml/nusoap/samples/client1.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: client1.php,v 1.1 2004/01/09 03:23:42 snichol Exp $
4  *
5  *    Client sample that should get a fault response.
6  *
7  *    Service: SOAP endpoint
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://soap.amazon.com/onca/soap2", false,
18                         $proxyhost, $proxyport, $proxyusername, $proxypassword);
19 $err = $client->getError();
20 if ($err) {
21     echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
22 }
23 // This is an archaic parameter list
24 $params = array(
25     'manufacturer' => "O'Reilly",
26     'page'         => '1',
27     'mode'         => 'books',
28     'tag'          => 'trachtenberg-20',
29     'type'         => 'lite',
30     'devtag'       => 'D35PWRR0R0URC3',
31     'sort'         => '+title'
32 );
33 $result = $client->call('ManufacturerSearchRequest', $params, 'http://soap.amazon.com', 'http://soap.amazon.com');
34 if ($client->fault) {
35     echo '<h2>Fault (This is expected)</h2><pre>'; print_r($result); echo '</pre>';
36 } else {
37     $err = $client->getError();
38     if ($err) {
39         echo '<h2>Error</h2><pre>' . $err . '</pre>';
40     } else {
41         echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
42     }
43 }
44 echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
45 echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
46 echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
47 ?>
48
Note: See TracBrowser for help on using the browser.