Ignore:
Timestamp:
2011/10/25 00:02:55 (15 years ago)
Author:
Seasoft
Message:

#1521 (PEAR::SOAP 配布と異なる部分がある)

  • 新しいバージョンの配布ファイルを上書きすることで解決

#1522 (PEAR::SOAP をバージョンアップ)

  • 0.11.0 -> 0.12.0
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_11-dev/data/module/SOAP/example/client.php

    r20119 r21299  
    1616 * @package    SOAP 
    1717 * @author     Shane Caraveo <[email protected]>   Port to PEAR and more 
    18  * @copyright  2003-2005 The PHP Group 
     18 * @author     Jan Schneider <[email protected]>       Maintenance 
     19 * @copyright  2003-2007 The PHP Group 
    1920 * @license    http://www.php.net/license/2_02.txt  PHP License 2.02 
    2021 * @link       http://pear.php.net/package/SOAP 
    2122 */ 
    2223 
     24/** SOAP_Client */ 
    2325require 'SOAP/Client.php'; 
    2426 
    25 /** 
    26  * This client runs against the example server in SOAP/example/server.php.  It 
     27/* This client runs against the example server in SOAP/example/server.php.  It 
    2728 * does not use WSDL to run these requests, but that can be changed easily by 
    28  * simply adding '?wsdl' to the end of the url. 
    29  */ 
     29 * simply adding '?wsdl' to the end of the url. */ 
    3030$soapclient = new SOAP_Client('http://localhost/SOAP/example/server.php'); 
    31 // This namespace is the same as declared in server.php. 
    32 $options = array('namespace' => 'urn:SOAP_Example_Server', 
    33                  'trace' => true); 
    3431 
     32/* Set a few options. */ 
     33$options = array(); 
     34 
     35/* This namespace is the same as declared in server.php. */ 
     36$options['namespace'] = 'urn:SOAP_Example_Server'; 
     37 
     38/* Trace the communication for debugging purposes, so we can later inspect the 
     39 * data with getWire(). */ 
     40$options['trace'] = true; 
     41 
     42/* Uncomment the following lines if you want to use Basic HTTP 
     43 * Authentication. */ 
     44// $options['user'] = 'username'; 
     45// $options['pass'] = 'password'; 
     46 
     47header('Content-Type: text/plain'); 
     48 
     49/* Calling echoStringSimple. */ 
    3550$ret = $soapclient->call('echoStringSimple', 
    36                          $params = array('inputStringSimple' => 'this is a test string'), 
     51                         array('inputStringSimple' => 'this is a test string'), 
    3752                         $options); 
    38 // print $soapclient->getWire(); 
     53// echo $soapclient->getWire(); 
    3954print_r($ret); 
    40 echo "<br>\n"; 
     55echo "\n"; 
    4156 
     57/* Calling echoString. */ 
    4258$ret = $soapclient->call('echoString', 
    43                          $params = array('inputString' => 'this is a test string'), 
     59                         array('inputString' => 'this is a test string'), 
    4460                         $options); 
     61// echo $soapclient->getWire(); 
    4562print_r($ret); 
    46 echo "<br>\n"; 
     63echo "\n"; 
    4764 
     65/* Calling divide with valid parameters. */ 
    4866$ret = $soapclient->call('divide', 
    49                          $params = array('dividend' => 22, 'divisor' => 7), 
     67                         array('dividend' => 22, 'divisor' => 7), 
    5068                         $options); 
    51 // print $soapclient->getWire(); 
     69// echo $soapclient->getWire(); 
    5270if (PEAR::isError($ret)) { 
    53     echo 'Error: ' . $ret->getMessage() . "<br>\n"; 
     71    echo 'Error: ' . $ret->getMessage(); 
    5472} else { 
    55     echo 'Quotient is ' . $ret . "<br>\n"; 
     73    echo 'Quotient is ' . $ret; 
    5674} 
     75echo "\n"; 
    5776 
     77/* Calling divide with invalid parameters. */ 
    5878$ret = $soapclient->call('divide', 
    59                          $params = array('dividend' => 22, 'divisor' => 0), 
     79                         array('dividend' => 22, 'divisor' => 0), 
    6080                         $options); 
     81// echo $soapclient->getWire(); 
    6182if (PEAR::isError($ret)) { 
    62     echo 'Error: ' . $ret->getMessage() . "<br>\n"; 
     83    echo 'Error: ' . $ret->getMessage(); 
    6384} else { 
    64     echo 'Quotient is ' . $ret . "<br>\n"; 
     85    echo 'Quotient is ' . $ret; 
    6586} 
     87echo "\n"; 
    6688 
    67  
    68 // SOAPStruct is defined in the following file. 
     89/* The SOAPStruct class is defined in example_types.php. */ 
    6990require_once 'example_types.php'; 
    70  
    7191$struct = new SOAPStruct('test string', 123, 123.123); 
    7292 
     
    7494 * we provide if possible. */ 
    7595$soapclient->_auto_translation = true; 
     96 
    7697/* You can explicitly set the translation for a specific 
    7798 * class. auto_translation works for all cases, but opens ANY class in the 
     
    80101$soapclient->setTypeTranslation('{http://soapinterop.org/xsd}SOAPStruct', 
    81102                                'SOAPStruct'); 
     103 
     104/* Calling echoStruct. */ 
    82105$ret = $soapclient->call('echoStruct', 
    83                          $p = array('inputStruct' => $struct->__to_soap()), 
     106                         array('inputStruct' => $struct->__to_soap()), 
    84107                         $options); 
    85 // print $soapclient->getWire(); 
     108// echo $soapclient->getWire(); 
    86109print_r($ret); 
    87110 
    88 /** 
    89  * PHP doesn't support multiple OUT parameters in function calls, so we must 
    90  * do a little work to make it happen here.  This requires knowledge on the 
    91  * developers part to figure out how they want to deal with it. 
    92  */ 
     111/* Calling echoStructAsSimpleTypes. 
     112 * PHP doesn't support multiple return values in function calls, so we must do 
     113 * a little work to make it happen here, for example returning an array 
     114 * instead.  This requires knowledge on the developers part to figure out how 
     115 * they want to deal with it. */ 
    93116$ret = $soapclient->call('echoStructAsSimpleTypes', 
    94                          $p = array('inputStruct' => $struct->__to_soap()), 
     117                         array('inputStruct' => $struct->__to_soap()), 
    95118                         $options); 
     119// echo $soapclient->getWire(); 
    96120if (PEAR::isError($ret)) { 
    97     echo 'Error: ' . $ret->getMessage() . "<br>\n"; 
     121    echo 'Error: ' . $ret->getMessage(); 
    98122} else { 
    99123    list($string, $int, $float) = array_values($ret); 
    100     echo "varString: $string<br>\nvarInt: $int<br>\nvarFloat: $float<br>\n"; 
     124    echo "varString: $string\nvarInt: $int\nvarFloat: $float"; 
    101125} 
     126echo "\n"; 
     127 
     128/* Calling echoMimeAttachment. 
     129 * We want to use MIME encoding here, the default is to use DIME encoding. */ 
     130$options['attachments'] = 'Mime'; 
     131$attachment = new SOAP_Attachment('attachment', 'text/plain', null, 
     132                                  'This is a MIME attachment'); 
     133$ret = $soapclient->call('echoMimeAttachment', 
     134                         array($attachment), 
     135                         $options); 
     136// echo $soapclient->getWire(); 
     137print_r($ret); 
Note: See TracChangeset for help on using the changeset viewer.