Ignore:
Timestamp:
2011/10/31 13:54:41 (12 years ago)
Author:
kotani
Message:

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

  • 新しいバージョンの配布ファイルを上書きすることで解決
  • →2.11.4には含めないため一旦コミットキャンセル

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

  • 0.11.0 -> 0.12.0
  • →2.11.4には含めないため一旦コミットキャンセル
File:
1 edited

Legend:

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

    r21299 r21304  
    1616 * @package    SOAP 
    1717 * @author     Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more 
    18  * @author     Jan Schneider <jan@horde.org>       Maintenance 
    19  * @copyright  2003-2007 The PHP Group 
     18 * @copyright  2003-2005 The PHP Group 
    2019 * @license    http://www.php.net/license/2_02.txt  PHP License 2.02 
    2120 * @link       http://pear.php.net/package/SOAP 
    2221 */ 
    2322 
    24 /** SOAP_Client */ 
    2523require 'SOAP/Client.php'; 
    2624 
    27 /* This client runs against the example server in SOAP/example/server.php.  It 
     25/** 
     26 * This client runs against the example server in SOAP/example/server.php.  It 
    2827 * does not use WSDL to run these requests, but that can be changed easily by 
    29  * simply adding '?wsdl' to the end of the url. */ 
     28 * simply adding '?wsdl' to the end of the url. 
     29 */ 
    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); 
    3134 
    32 /* Set a few options. */ 
    33 $options = array(); 
     35$ret = $soapclient->call('echoStringSimple', 
     36                         $params = array('inputStringSimple' => 'this is a test string'), 
     37                         $options); 
     38// print $soapclient->getWire(); 
     39print_r($ret); 
     40echo "<br>\n"; 
    3441 
    35 /* This namespace is the same as declared in server.php. */ 
    36 $options['namespace'] = 'urn:SOAP_Example_Server'; 
     42$ret = $soapclient->call('echoString', 
     43                         $params = array('inputString' => 'this is a test string'), 
     44                         $options); 
     45print_r($ret); 
     46echo "<br>\n"; 
    3747 
    38 /* Trace the communication for debugging purposes, so we can later inspect the 
    39  * data with getWire(). */ 
    40 $options['trace'] = true; 
     48$ret = $soapclient->call('divide', 
     49                         $params = array('dividend' => 22, 'divisor' => 7), 
     50                         $options); 
     51// print $soapclient->getWire(); 
     52if (PEAR::isError($ret)) { 
     53    echo 'Error: ' . $ret->getMessage() . "<br>\n"; 
     54} else { 
     55    echo 'Quotient is ' . $ret . "<br>\n"; 
     56} 
    4157 
    42 /* Uncomment the following lines if you want to use Basic HTTP 
    43  * Authentication. */ 
    44 // $options['user'] = 'username'; 
    45 // $options['pass'] = 'password'; 
     58$ret = $soapclient->call('divide', 
     59                         $params = array('dividend' => 22, 'divisor' => 0), 
     60                         $options); 
     61if (PEAR::isError($ret)) { 
     62    echo 'Error: ' . $ret->getMessage() . "<br>\n"; 
     63} else { 
     64    echo 'Quotient is ' . $ret . "<br>\n"; 
     65} 
    4666 
    47 header('Content-Type: text/plain'); 
    4867 
    49 /* Calling echoStringSimple. */ 
    50 $ret = $soapclient->call('echoStringSimple', 
    51                          array('inputStringSimple' => 'this is a test string'), 
    52                          $options); 
    53 // echo $soapclient->getWire(); 
    54 print_r($ret); 
    55 echo "\n"; 
     68// SOAPStruct is defined in the following file. 
     69require_once 'example_types.php'; 
    5670 
    57 /* Calling echoString. */ 
    58 $ret = $soapclient->call('echoString', 
    59                          array('inputString' => 'this is a test string'), 
    60                          $options); 
    61 // echo $soapclient->getWire(); 
    62 print_r($ret); 
    63 echo "\n"; 
    64  
    65 /* Calling divide with valid parameters. */ 
    66 $ret = $soapclient->call('divide', 
    67                          array('dividend' => 22, 'divisor' => 7), 
    68                          $options); 
    69 // echo $soapclient->getWire(); 
    70 if (PEAR::isError($ret)) { 
    71     echo 'Error: ' . $ret->getMessage(); 
    72 } else { 
    73     echo 'Quotient is ' . $ret; 
    74 } 
    75 echo "\n"; 
    76  
    77 /* Calling divide with invalid parameters. */ 
    78 $ret = $soapclient->call('divide', 
    79                          array('dividend' => 22, 'divisor' => 0), 
    80                          $options); 
    81 // echo $soapclient->getWire(); 
    82 if (PEAR::isError($ret)) { 
    83     echo 'Error: ' . $ret->getMessage(); 
    84 } else { 
    85     echo 'Quotient is ' . $ret; 
    86 } 
    87 echo "\n"; 
    88  
    89 /* The SOAPStruct class is defined in example_types.php. */ 
    90 require_once 'example_types.php'; 
    9171$struct = new SOAPStruct('test string', 123, 123.123); 
    9272 
     
    9474 * we provide if possible. */ 
    9575$soapclient->_auto_translation = true; 
    96  
    9776/* You can explicitly set the translation for a specific 
    9877 * class. auto_translation works for all cases, but opens ANY class in the 
     
    10180$soapclient->setTypeTranslation('{http://soapinterop.org/xsd}SOAPStruct', 
    10281                                'SOAPStruct'); 
    103  
    104 /* Calling echoStruct. */ 
    10582$ret = $soapclient->call('echoStruct', 
    106                          array('inputStruct' => $struct->__to_soap()), 
     83                         $p = array('inputStruct' => $struct->__to_soap()), 
    10784                         $options); 
    108 // echo $soapclient->getWire(); 
     85// print $soapclient->getWire(); 
    10986print_r($ret); 
    11087 
    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. */ 
     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 */ 
    11693$ret = $soapclient->call('echoStructAsSimpleTypes', 
    117                          array('inputStruct' => $struct->__to_soap()), 
     94                         $p = array('inputStruct' => $struct->__to_soap()), 
    11895                         $options); 
    119 // echo $soapclient->getWire(); 
    12096if (PEAR::isError($ret)) { 
    121     echo 'Error: ' . $ret->getMessage(); 
     97    echo 'Error: ' . $ret->getMessage() . "<br>\n"; 
    12298} else { 
    12399    list($string, $int, $float) = array_values($ret); 
    124     echo "varString: $string\nvarInt: $int\nvarFloat: $float"; 
     100    echo "varString: $string<br>\nvarInt: $int<br>\nvarFloat: $float<br>\n"; 
    125101} 
    126 echo "\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(); 
    137 print_r($ret); 
Note: See TracChangeset for help on using the changeset viewer.