Ignore:
Timestamp:
2012/01/17 16:32:25 (14 years ago)
Author:
Seasoft
Message:

2.12系へマイルストーン変更となったチケット分を差し戻し
r21326 #1536
r21325 #1528
r21324 #1547,#1546
r21323 #1546
r21322 #1543
r21321 #1536
r21320 #1536
r21319 #1544
r21318 #1521,#1522
r21317 #1431

File:
1 edited

Legend:

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

    r21318 r21410  
    11<?php 
     2// 
     3// +----------------------------------------------------------------------+ 
     4// | PHP Version 4                                                        | 
     5// +----------------------------------------------------------------------+ 
     6// | Copyright (c) 1997-2003 The PHP Group                                | 
     7// +----------------------------------------------------------------------+ 
     8// | This source file is subject to version 2.02 of the PHP license,      | 
     9// | that is bundled with this package in the file LICENSE, and is        | 
     10// | available at through the world-wide-web at                           | 
     11// | http://www.php.net/license/2_02.txt.                                 | 
     12// | If you did not receive a copy of the PHP license and are unable to   | 
     13// | obtain it through the world-wide-web, please send a note to          | 
     14// | [email protected] so we can mail you a copy immediately.               | 
     15// +----------------------------------------------------------------------+ 
     16// | Authors: Shane Caraveo <[email protected]>                           | 
     17// +----------------------------------------------------------------------+ 
     18// 
     19// $Id: wsdl_client.php,v 1.5 2007/01/22 11:33:27 yunosh Exp $ 
     20// 
     21include("SOAP/Client.php"); 
     22 
    223/** 
    3  * WSDL client. 
    4  * 
    5  * PHP versions 4 and 5 
    6  * 
    7  * LICENSE: This source file is subject to version 2.02 of the PHP license, 
    8  * that is bundled with this package in the file LICENSE, and is available at 
    9  * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you 
    10  * did not receive a copy of the PHP license and are unable to obtain it 
    11  * through the world-wide-web, please send a note to [email protected] so we can 
    12  * mail you a copy immediately. 
    13  * 
    14  * @category   Web Services 
    15  * @package    SOAP 
    16  * @author     Shane Caraveo <[email protected]>   Port to PEAR and more 
    17  * @author     Jan Schneider <[email protected]>       Maintenance 
    18  * @copyright  2003-2007 The PHP Group 
    19  * @license    http://www.php.net/license/2_02.txt  PHP License 2.02 
    20  * @link       http://pear.php.net/package/SOAP 
     24 * this client runs against the example server in SOAP/example/server.php 
     25 * it does not use WSDL to run these requests, but that can be changed easily by simply 
     26 * adding '?wsdl' to the end of the url. 
    2127 */ 
    22  
    23 require_once 'SOAP/Client.php'; 
    24  
    25 /* This client runs against the example server in SOAP/example/server.php.  It 
    26  * does not use WSDL to run these requests, but that can be changed easily by 
    27  * simply adding '?wsdl' to the end of the url. */ 
    28 $wsdl = new SOAP_WSDL('http://localhost/SOAP/example/server.php?wsdl'); 
     28$wsdl = new SOAP_WSDL("http://localhost/SOAP/example/server.php?wsdl"); 
    2929$soapclient = $wsdl->getProxy(); 
    3030 
    31 $ret = $soapclient->echoStringSimple('this is a test string'); 
    32 // echo $soapclient->getWire(); 
    33 print_r($ret); 
     31$ret = $soapclient->echoStringSimple("this is a test string"); 
     32//print $soapclient->getWire(); 
     33print_r($ret);echo "<br>\n"; 
    3434 
    35 $ret = $soapclient->echoString('this is a test string'); 
    36 print_r($ret); 
     35$ret = $soapclient->echoString("this is a test string"); 
     36print_r($ret);echo "<br>\n"; 
    3737 
    38 $ret = $soapclient->divide(22, 7); 
    39 // echo $soapclient->getWire(); 
    40 if (is_a($ret, 'PEAR_Error')) { 
    41     echo 'Error: ' . $ret->getMessage() . "\n"; 
    42 } else { 
    43     echo 'Quotient is ' . $ret . "\n"; 
    44 } 
     38$ret = $soapclient->divide(22,7); 
     39// print $soapclient->getWire(); 
     40if (PEAR::isError($ret)) 
     41    print("Error: " . $ret->getMessage() . "<br>\n"); 
     42else 
     43    print("Quotient is " . $ret . "<br>\n"); 
    4544 
    46 $ret = $soapclient->divide(22, 0); 
    47 if (is_a($ret, 'PEAR_Error')) { 
    48     echo 'Error: ' . $ret->getMessage() . "\n"; 
    49 } else { 
    50     echo 'Quotient is ' . $ret . "\n"; 
    51 } 
     45$ret = $soapclient->divide(22,0); 
     46if (PEAR::isError($ret)) 
     47    print("Error: " . $ret->getMessage() . "<br>\n"); 
     48else 
     49    print("Quotient is " . $ret . "<br>\n"); 
    5250 
    53 /* SOAPStruct is defined in the following file. */ 
    54 require_once './example_types.php'; 
    55 $struct = new SOAPStruct('test string', 123, 123.123); 
    5651 
    57 /* Tell the client to translate to classes we provide if possible. 
    58  * You can explicitly set the translation for a specific class. 
     52// SOAPStruct is defined in the following file 
     53require_once 'example_types.php'; 
     54 
     55$struct = new SOAPStruct('test string',123,123.123); 
     56 
     57/* Send an object, get an object back. 
     58 * Tell the client to translate to classes we provide if possible. */ 
     59$soapclient->_auto_translation = true; 
     60/* Or you can explicitly set the translation for a specific class. 
    5961 * auto_translation works for all cases, but opens ANY class in the script to 
    60  * be used as a data type, and may not be desireable.  Both can be used on 
     62 * be used as a data type, and may not be desireable.  both can be used on 
    6163 * client or server. */ 
    62 $soapclient->_auto_translation = true; 
    63  
    6464$soapclient->setTypeTranslation('{http://soapinterop.org/xsd}SOAPStruct', 
    6565                                'SOAPStruct'); 
    6666$ret = $soapclient->echoStruct($struct->__to_soap()); 
    67 // echo $soapclient->getWire(); 
     67//print $soapclient->getWire(); 
    6868print_r($ret); 
    6969 
    70 /* PHP doesn't support multiple OUT parameters in function calls, so we must 
     70/** 
     71 * PHP doesn't support multiple OUT parameters in function calls, so we must 
    7172 * do a little work to make it happen here.  This requires knowledge on the 
    72  * developers part to figure out how they want to deal with it. */ 
     73 * developers part to figure out how they want to deal with it. 
     74 */ 
    7375$ret = $soapclient->echoStructAsSimpleTypes($struct->__to_soap()); 
    74 if (is_a($ret, 'PEAR_Error')) { 
    75     echo 'Error: ' . $ret->getMessage() . "\n"; 
     76if (PEAR::isError($ret)) { 
     77    print("Error: " . $ret->getMessage() . "<br>\n"); 
    7678} else { 
    7779    list($string, $int, $float) = array_values($ret); 
    7880} 
    79 echo "varString: $string\nvarInt: $int\nvarFloat: $float\n"; 
     81echo "varString: $string<br>\nvarInt: $int<br>\nvarFloat: $float<br>\n"; 
     82 
     83?> 
Note: See TracChangeset for help on using the changeset viewer.