SOAP_Attachement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



        Hi,

        I want to download from my website large files (500KB-10 MB) using web
services. I'm using PHP PEAR SOAP 0.9.1 under PHP 4.3 (Debian stable).
        
        To do it, it is possible to encode files in base64 in a string field (see
the next code) but i would like to replace it by a MIME attachement.
SOAP_Attachement is supposed to do that but all that i have tested doesn't
work !

        Thank you in advance for any assistance you can offer.

        Laurent.

<?
require_once('SOAP/Server.php');
require_once('SOAP/Disco.php');

class ServerTest
{
  var $__dispatch_map = array();
  
  function ServerTest() {
  
    $this->__dispatch_map['DownloadFile'] =
        array('in' => array('file' => 'string'),
              'out' => array('return' => 'base64Binary'));       
  }
            
  function DownloadFile($file) {
    
    if (file_exists($file))
      return base64_encode(file_get_contents($file)); 

    return null;
  }
}

// Create the server
$server = new SOAP_Server();
$webservice = new ServerTest();
$server->addObjectMap($webservice, 'urn:ServerTest');
if (isset($_SERVER['REQUEST_METHOD'])  &&
     $_SERVER['REQUEST_METHOD']=='POST') {
     $server->service($HTTP_RAW_POST_DATA);
} else {
     // Create the DISCO server
     $disco = new SOAP_DISCO_Server($server,'Lims');
     header("Content-type: text/xml");
     if (isset($_SERVER['QUERY_STRING']) &&
         strcasecmp($_SERVER['QUERY_STRING'],'wsdl') == 0) {
         echo $disco->getWSDL();
     } else {
         echo $disco->getDISCO();
     }
}
exit; 
?>

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux