SOAP_Interop
[ class tree: SOAP_Interop ] [ index: SOAP_Interop ] [ all elements ]

Source for file interop_Round2Base.php

Documentation is available at interop_Round2Base.php

  1. <?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. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Shane Caraveo <Shane@Caraveo.com>   Port to PEAR and more   |
  17. // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author         |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: interop_Round2Base.php,v 1.7 2004/06/10 07:54:03 arnaud Exp $
  21. //
  22. require_once 'params_classes.php';
  23.  
  24. function &generateFault($short$long)
  25. {
  26.     $params = array(
  27.         "faultcode" => "Server",
  28.         "faultstring" => $short,
  29.         "detail" => $long
  30.     );
  31.  
  32.     $faultmsg  =new SOAP_Message("Fault",$params,"http://schemas.xmlsoap.org/soap/envelope/");
  33.     return $faultmsg;
  34. }
  35.  
  36. function hex2bin($data)
  37. {
  38.     $len strlen($data);
  39.     return pack("H" $len$data);
  40. }
  41.  
  42.  
  43. class SOAP_Interop_Base {
  44.  
  45.     function &echoString($inputString)
  46.     {
  47.     return new SOAP_Value('outputString','string',$inputString);
  48.     }
  49.  
  50.     function &echoStringArray($inputStringArray)
  51.     {
  52.     $ra = array();
  53.     if ($inputStringArray{
  54.     foreach($inputStringArray as $s{
  55.         $ra[=new SOAP_Value('item','string',$s);
  56.     }
  57.     }
  58.     return new SOAP_Value('outputStringArray',NULL,$ra);
  59.     }
  60.  
  61.  
  62.     function &echoInteger($inputInteger)
  63.     {
  64.     return new SOAP_Value('outputInteger','int',(integer)$inputInteger);
  65.     }
  66.  
  67.     function &echoIntegerArray($inputIntegerArray)
  68.     {
  69.     $ra = array();
  70.     if ($inputIntegerArray{
  71.     foreach ($inputIntegerArray as $i{
  72.         $ra[=new SOAP_Value('item','int',$i);
  73.     }
  74.     }
  75.     return new SOAP_Value('outputIntArray',NULL,$ra);
  76.     }
  77.  
  78.     function &echoFloat($inputFloat)
  79.     {
  80.     return new SOAP_Value('outputFloat','float',(FLOAT)$inputFloat);
  81.     }
  82.  
  83.     function &echoFloatArray($inputFloatArray)
  84.     {
  85.     $ra = array();
  86.     if ($inputFloatArray{
  87.     foreach($inputFloatArray as $float{
  88.         $ra[=new SOAP_Value('item','float',(FLOAT)$float);
  89.     }
  90.     }
  91.     return new SOAP_Value('outputFloatArray',NULL,$ra);
  92.     }
  93.  
  94.     function &echoStruct($inputStruct)
  95.     {
  96.         if (strtolower(get_class($inputStruct)) == 'soapstruct')
  97.             return $inputStruct->__to_soap();
  98.         return $inputStruct;
  99.     }
  100.  
  101.     function &echoStructArray($inputStructArray)
  102.     {
  103.     $ra = array();
  104.     if ($inputStructArray{
  105.         $c count($inputStructArray);
  106.         for ($i = 0; $i $c$i++{
  107.             $ra[$this->echoStruct($inputStructArray[$i]);
  108.         }
  109.     }
  110.     return $ra;
  111.     }
  112.  
  113.     function echoVoid()
  114.     {
  115.     return NULL;
  116.     }
  117.  
  118.     function &echoBase64($b_encoded)
  119.     {
  120.     return new SOAP_Value('return','base64Binary',base64_encode(base64_decode($b_encoded)));
  121.     }
  122.  
  123.     function &echoDate($timeInstant)
  124.     {
  125.     $dt =new SOAP_Type_dateTime($timeInstant);
  126.     if ($dt->toUnixtime(!= -1{
  127.         $value $dt->toSOAP();
  128.         return new SOAP_Value('return','dateTime',$value);
  129.     else {
  130.         return new SOAP_Fault("Value $timeInstant is not a dateTime value");
  131.     }
  132.     }
  133.  
  134.     function &echoHexBinary($hb)
  135.     {
  136.     return new SOAP_Value('return','hexBinary',bin2hex(hex2bin($hb)));
  137.     }
  138.  
  139.     function &echoDecimal($dec)
  140.     {
  141.     return new SOAP_Value('return','decimal',(FLOAT)$dec);
  142.     }
  143.  
  144.     function &echoBoolean($boolean)
  145.     {
  146.     return new SOAP_Value('return','boolean',$boolean);
  147.     }
  148.  
  149.     function &echoMimeAttachment($stuff)
  150.     {
  151.         return new SOAP_Attachment('return','application/octet-stream',NULL,$stuff);
  152.     }
  153. }
  154.  
  155. ?>

Documentation generated on Mon, 11 Mar 2019 14:54:33 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.