nusoap_server_mime Klassenreferenz

Klassendiagramm für nusoap_server_mime:

Inheritance graph
[Legende]
Zusammengehörigkeiten von nusoap_server_mime:

Collaboration graph
[Legende]

Aufstellung aller Elemente

Öffentliche Methoden

 addAttachment ($data, $filename= '', $contenttype= 'application/octet-stream', $cid=false)
 clearAttachments ()
 getAttachments ()
 getHTTPBody ($soapmsg)
 getHTTPContentType ()
 getHTTPContentTypeCharset ()
 parseRequest ($headers, $data)

Öffentliche Attribute

 $requestAttachments = array()
 $responseAttachments
 $mimeContentType


Ausführliche Beschreibung

nusoap_server_mime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.

Autor:
Scott Nichol <snichol@users.sourceforge.net>

Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list

Version:
Id
nusoapmime.php,v 1.12 2007/04/17 16:34:03 snichol Exp
public

Definiert in Zeile 284 der Datei nusoapmime.php.


Dokumentation der Elementfunktionen

nusoap_server_mime::addAttachment ( data,
filename = '',
contenttype = 'application/octet-stream',
cid = false 
)

adds a MIME attachment to the current response.

If the $data parameter contains an empty string, this method will read the contents of the file named by the $filename parameter.

If the $cid parameter is false, this method will generate the cid.

Parameter:
string $data The data of the attachment
string $filename The filename of the attachment (default is empty string)
string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream)
string $cid The content-id (cid) of the attachment (default is false)
Rückgabe:
string The content-id (cid) of the attachment public

Definiert in Zeile 318 der Datei nusoapmime.php.

00318                                                                                                                {
00319                 if (! $cid) {
00320                         $cid = md5(uniqid(time()));
00321                 }
00322 
00323                 $info['data'] = $data;
00324                 $info['filename'] = $filename;
00325                 $info['contenttype'] = $contenttype;
00326                 $info['cid'] = $cid;
00327                 
00328                 $this->responseAttachments[] = $info;
00329 
00330                 return $cid;
00331         }

nusoap_server_mime::clearAttachments (  ) 

clears the MIME attachments for the current response.

public

Definiert in Zeile 338 der Datei nusoapmime.php.

00338                                     {
00339                 $this->responseAttachments = array();
00340         }

nusoap_server_mime::getAttachments (  ) 

gets the MIME attachments from the current request.

Each array element in the return is an associative array with keys data, filename, contenttype, cid. These keys correspond to the parameters for addAttachment.

Rückgabe:
array The attachments. public

Definiert in Zeile 352 der Datei nusoapmime.php.

00352                                   {
00353                 return $this->requestAttachments;
00354         }

nusoap_server_mime::getHTTPBody ( soapmsg  ) 

gets the HTTP body for the current response.

Parameter:
string $soapmsg The SOAP payload
Rückgabe:
string The HTTP body, which includes the SOAP payload private

Erneute Implementation von nusoap_server.

Definiert in Zeile 363 der Datei nusoapmime.php.

00363                                        {
00364                 if (count($this->responseAttachments) > 0) {
00365                         $params['content_type'] = 'multipart/related; type="text/xml"';
00366                         $mimeMessage =& new Mail_mimePart('', $params);
00367                         unset($params);
00368 
00369                         $params['content_type'] = 'text/xml';
00370                         $params['encoding']     = '8bit';
00371                         $params['charset']      = $this->soap_defencoding;
00372                         $mimeMessage->addSubpart($soapmsg, $params);
00373                         
00374                         foreach ($this->responseAttachments as $att) {
00375                                 unset($params);
00376 
00377                                 $params['content_type'] = $att['contenttype'];
00378                                 $params['encoding']     = 'base64';
00379                                 $params['disposition']  = 'attachment';
00380                                 $params['dfilename']    = $att['filename'];
00381                                 $params['cid']          = $att['cid'];
00382 
00383                                 if ($att['data'] == '' && $att['filename'] <> '') {
00384                                         if ($fd = fopen($att['filename'], 'rb')) {
00385                                                 $data = fread($fd, filesize($att['filename']));
00386                                                 fclose($fd);
00387                                         } else {
00388                                                 $data = '';
00389                                         }
00390                                         $mimeMessage->addSubpart($data, $params);
00391                                 } else {
00392                                         $mimeMessage->addSubpart($att['data'], $params);
00393                                 }
00394                         }
00395 
00396                         $output = $mimeMessage->encode();
00397                         $mimeHeaders = $output['headers'];
00398         
00399                         foreach ($mimeHeaders as $k => $v) {
00400                                 $this->debug("MIME header $k: $v");
00401                                 if (strtolower($k) == 'content-type') {
00402                                         // PHP header() seems to strip leading whitespace starting
00403                                         // the second line, so force everything to one line
00404                                         $this->mimeContentType = str_replace("\r\n", " ", $v);
00405                                 }
00406                         }
00407         
00408                         return $output['body'];
00409                 }
00410 
00411                 return parent::getHTTPBody($soapmsg);
00412         }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

nusoap_server_mime::getHTTPContentType (  ) 

gets the HTTP content type for the current response.

Note: getHTTPBody must be called before this.

Rückgabe:
string the HTTP content type for the current response. private

Erneute Implementation von nusoap_server.

Definiert in Zeile 422 der Datei nusoapmime.php.

00422                                       {
00423                 if (count($this->responseAttachments) > 0) {
00424                         return $this->mimeContentType;
00425                 }
00426                 return parent::getHTTPContentType();
00427         }

nusoap_server_mime::getHTTPContentTypeCharset (  ) 

gets the HTTP content type charset for the current response. returns false for non-text content types.

Note: getHTTPBody must be called before this.

Rückgabe:
string the HTTP content type charset for the current response. private

Erneute Implementation von nusoap_server.

Definiert in Zeile 438 der Datei nusoapmime.php.

00438                                              {
00439                 if (count($this->responseAttachments) > 0) {
00440                         return false;
00441                 }
00442                 return parent::getHTTPContentTypeCharset();
00443         }

nusoap_server_mime::parseRequest ( headers,
data 
)

processes SOAP message received from client

Parameter:
array $headers The HTTP headers
string $data unprocessed request data from client
Rückgabe:
mixed value of the message, decoded into a PHP type private

Erneute Implementation von nusoap_server.

Definiert in Zeile 453 der Datei nusoapmime.php.

00453                                            {
00454                 $this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
00455                 $this->requestAttachments = array();
00456                 if (strstr($headers['content-type'], 'multipart/related')) {
00457                         $this->debug('Decode multipart/related');
00458                         $input = '';
00459                         foreach ($headers as $k => $v) {
00460                                 $input .= "$k: $v\r\n";
00461                         }
00462                         $params['input'] = $input . "\r\n" . $data;
00463                         $params['include_bodies'] = true;
00464                         $params['decode_bodies'] = true;
00465                         $params['decode_headers'] = true;
00466                         
00467                         $structure = Mail_mimeDecode::decode($params);
00468 
00469                         foreach ($structure->parts as $part) {
00470                                 if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) {
00471                                         $this->debug('Have root part of type ' . $part->headers['content-type']);
00472                                         $return = parent::parseRequest($part->headers, $part->body);
00473                                 } else {
00474                                         $this->debug('Have an attachment of type ' . $part->headers['content-type']);
00475                                         $info['data'] = $part->body;
00476                                         $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
00477                                         $info['contenttype'] = $part->headers['content-type'];
00478                                         $info['cid'] = $part->headers['content-id'];
00479                                         $this->requestAttachments[] = $info;
00480                                 }
00481                         }
00482                 
00483                         if (isset($return)) {
00484                                 return $return;
00485                         }
00486                         
00487                         $this->setError('No root part found in multipart/related content');
00488                         return;
00489                 }
00490                 $this->debug('Not multipart/related');
00491                 return parent::parseRequest($headers, $data);
00492         }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:


Dokumentation der Datenelemente

nusoap_server_mime::$mimeContentType

Definiert in Zeile 301 der Datei nusoapmime.php.

nusoap_server_mime::$requestAttachments = array()

Definiert in Zeile 290 der Datei nusoapmime.php.

nusoap_server_mime::$responseAttachments

Definiert in Zeile 296 der Datei nusoapmime.php.


Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei:
Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved.
MyOOS [Shopsystem] is Free Software released under the GNU/GPL License.

Webmaster: info@r23.de (Impressum)
doxygen