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.9 2007/01/26 00:06:11 yunosh 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.         }
  99.         return $inputStruct;
  100.     }
  101.  
  102.     function echoStructArray($inputStructArray)
  103.     {
  104.         $ra = array();
  105.         if ($inputStructArray{
  106.             $c count($inputStructArray);
  107.             for ($i = 0; $i $c$i++{
  108.                 $ra[$this->echoStruct($inputStructArray[$i]);
  109.             }
  110.         }
  111.         return $ra;
  112.     }
  113.  
  114.     function echoVoid()
  115.     {
  116.         return NULL;
  117.     }
  118.  
  119.     function echoBase64($b_encoded)
  120.     {
  121.         return new SOAP_Value('return''base64Binary'base64_encode(base64_decode($b_encoded)));
  122.     }
  123.  
  124.     function echoDate($timeInstant)
  125.     {
  126.         require_once 'SOAP/Type/dateTime.php';
  127.         $dt = new SOAP_Type_dateTime($timeInstant);
  128.         if ($dt->toUnixtime(!= -1{
  129.             $value $dt->toSOAP();
  130.             return new SOAP_Value('return''dateTime'$value);
  131.         else {
  132.             return new SOAP_Fault("Value $timeInstant is not a dateTime value");
  133.         }
  134.     }
  135.  
  136.     function echoHexBinary($hb)
  137.     {
  138.         return new SOAP_Value('return''hexBinary'bin2hex(hex2bin($hb)));
  139.     }
  140.  
  141.     function echoDecimal($dec)
  142.     {
  143.         return new SOAP_Value('return''decimal'(float)$dec);
  144.     }
  145.  
  146.     function echoBoolean($boolean)
  147.     {
  148.         return new SOAP_Value('return''boolean'$boolean);
  149.     }
  150.  
  151.     function echoMimeAttachment($stuff)
  152.     {
  153.         return new SOAP_Attachment('return''application/octet-stream'null$stuff);
  154.     }
  155. }

Documentation generated on Mon, 11 Mar 2019 15:06:26 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.