root/docs/usc/nautilus/usr2/prod/buoys/perl/xml/nusoap/samples/wsdlclient14.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: wsdlclient14.php,v 1.1 2005/04/22 19:16:08 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 require_once('../lib/class.wsdlcache.php');
14 $proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
15 $proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
16 $proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
17 $proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
18
19 echo 'You must set your own Via Michelin login and password in the source code to run this client!'; exit();
20 $login = '';
21 $password = '';
22
23 $wsdlurl = 'http://www.viamichelin.com/ws/services/Geocoding?wsdl';
24 $cache = new wsdlcache('.', 120);
25 $wsdl = $cache->get($wsdlurl);
26 if (is_null($wsdl)) {
27     $wsdl = new wsdl($wsdlurl,
28                     $proxyhost, $proxyport, $proxyusername, $proxypassword);
29     $cache->put($wsdl);
30 } else {
31     $wsdl->debug_str = '';
32     $wsdl->debug('Retrieved from cache');
33 }
34 $client = new soapclient($wsdl, true,
35                         $proxyhost, $proxyport, $proxyusername, $proxypassword);
36 $err = $client->getError();
37 if ($err) {
38     echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
39 }
40
41 $inputAddresses[] = array(
42     'address' => '45 Liberty Blvd.',
43     'cityName' => 'Malvern',
44     'countryCode' => 'USA',
45     'postalCode' => '19355',
46     'stateName' => 'PA'
47 );
48 $geocodingrequest = array('addressesList' => $inputAddresses);
49 $params = array('request' => $geocodingrequest, 'check' => "$login|$password");
50 $result = $client->call('getLocationsList', $params);
51
52 // Check for a fault
53 if ($client->fault) {
54     echo '<h2>Fault</h2><pre>';
55     print_r($result);
56     echo '</pre>';
57 } else {
58     // Check for errors
59     $err = $client->getError();
60     if ($err) {
61         // Display the error
62         echo '<h2>Error</h2><pre>' . $err . '</pre>';
63     } else {
64         // Display the result
65         echo '<h2>Result</h2><pre>';
66         print_r($result);
67         echo '</pre>';
68     }
69 }
70 echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
71 echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
72 echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
73 ?>
74
Note: See TracBrowser for help on using the browser.