nusoap_client_mime Klassenreferenz

Klassendiagramm für nusoap_client_mime:

Inheritance graph
[Legende]
Zusammengehörigkeiten von nusoap_client_mime:

Collaboration graph
[Legende]

Aufstellung aller Elemente

Öffentliche Methoden

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

Öffentliche Attribute

 $requestAttachments = array()
 $responseAttachments
 $mimeContentType


Ausführliche Beschreibung

nusoap_client_mime client 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 54 der Datei nusoapmime.php.


Dokumentation der Elementfunktionen

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

adds a MIME attachment to the current request.

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 88 der Datei nusoapmime.php.

00088                                                                                                                {
00089                 if (! $cid) {
00090                         $cid = md5(uniqid(time()));
00091                 }
00092 
00093                 $info['data'] = $data;
00094                 $info['filename'] = $filename;
00095                 $info['contenttype'] = $contenttype;
00096                 $info['cid'] = $cid;
00097                 
00098                 $this->requestAttachments[] = $info;
00099 
00100                 return $cid;
00101         }

nusoap_client_mime::clearAttachments (  ) 

clears the MIME attachments for the current request.

public

Definiert in Zeile 108 der Datei nusoapmime.php.

00108                                     {
00109                 $this->requestAttachments = array();
00110         }

nusoap_client_mime::getAttachments (  ) 

gets the MIME attachments from the current response.

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 122 der Datei nusoapmime.php.

00122                                   {
00123                 return $this->responseAttachments;
00124         }

nusoap_client_mime::getHTTPBody ( soapmsg  ) 

gets the HTTP body for the current request.

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

Erneute Implementation von nusoap_client.

Definiert in Zeile 133 der Datei nusoapmime.php.

00133                                        {
00134                 if (count($this->requestAttachments) > 0) {
00135                         $params['content_type'] = 'multipart/related; type="text/xml"';
00136                         $mimeMessage =& new Mail_mimePart('', $params);
00137                         unset($params);
00138 
00139                         $params['content_type'] = 'text/xml';
00140                         $params['encoding']     = '8bit';
00141                         $params['charset']      = $this->soap_defencoding;
00142                         $mimeMessage->addSubpart($soapmsg, $params);
00143                         
00144                         foreach ($this->requestAttachments as $att) {
00145                                 unset($params);
00146 
00147                                 $params['content_type'] = $att['contenttype'];
00148                                 $params['encoding']     = 'base64';
00149                                 $params['disposition']  = 'attachment';
00150                                 $params['dfilename']    = $att['filename'];
00151                                 $params['cid']          = $att['cid'];
00152 
00153                                 if ($att['data'] == '' && $att['filename'] <> '') {
00154                                         if ($fd = fopen($att['filename'], 'rb')) {
00155                                                 $data = fread($fd, filesize($att['filename']));
00156                                                 fclose($fd);
00157                                         } else {
00158                                                 $data = '';
00159                                         }
00160                                         $mimeMessage->addSubpart($data, $params);
00161                                 } else {
00162                                         $mimeMessage->addSubpart($att['data'], $params);
00163                                 }
00164                         }
00165 
00166                         $output = $mimeMessage->encode();
00167                         $mimeHeaders = $output['headers'];
00168         
00169                         foreach ($mimeHeaders as $k => $v) {
00170                                 $this->debug("MIME header $k: $v");
00171                                 if (strtolower($k) == 'content-type') {
00172                                         // PHP header() seems to strip leading whitespace starting
00173                                         // the second line, so force everything to one line
00174                                         $this->mimeContentType = str_replace("\r\n", " ", $v);
00175                                 }
00176                         }
00177         
00178                         return $output['body'];
00179                 }
00180 
00181                 return parent::getHTTPBody($soapmsg);
00182         }

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

nusoap_client_mime::getHTTPContentType (  ) 

gets the HTTP content type for the current request.

Note: getHTTPBody must be called before this.

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

Erneute Implementation von nusoap_client.

Definiert in Zeile 192 der Datei nusoapmime.php.

00192                                       {
00193                 if (count($this->requestAttachments) > 0) {
00194                         return $this->mimeContentType;
00195                 }
00196                 return parent::getHTTPContentType();
00197         }

nusoap_client_mime::getHTTPContentTypeCharset (  ) 

gets the HTTP content type charset for the current request. 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 request. private

Erneute Implementation von nusoap_client.

Definiert in Zeile 208 der Datei nusoapmime.php.

00208                                              {
00209                 if (count($this->requestAttachments) > 0) {
00210                         return false;
00211                 }
00212                 return parent::getHTTPContentTypeCharset();
00213         }

nusoap_client_mime::parseResponse ( headers,
data 
)

processes SOAP message returned from server

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

Erneute Implementation von nusoap_client.

Definiert in Zeile 223 der Datei nusoapmime.php.

00223                                             {
00224                 $this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
00225                 $this->responseAttachments = array();
00226                 if (strstr($headers['content-type'], 'multipart/related')) {
00227                         $this->debug('Decode multipart/related');
00228                         $input = '';
00229                         foreach ($headers as $k => $v) {
00230                                 $input .= "$k: $v\r\n";
00231                         }
00232                         $params['input'] = $input . "\r\n" . $data;
00233                         $params['include_bodies'] = true;
00234                         $params['decode_bodies'] = true;
00235                         $params['decode_headers'] = true;
00236                         
00237                         $structure = Mail_mimeDecode::decode($params);
00238 
00239                         foreach ($structure->parts as $part) {
00240                                 if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) {
00241                                         $this->debug('Have root part of type ' . $part->headers['content-type']);
00242                                         $root = $part->body;
00243                                         $return = parent::parseResponse($part->headers, $part->body);
00244                                 } else {
00245                                         $this->debug('Have an attachment of type ' . $part->headers['content-type']);
00246                                         $info['data'] = $part->body;
00247                                         $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
00248                                         $info['contenttype'] = $part->headers['content-type'];
00249                                         $info['cid'] = $part->headers['content-id'];
00250                                         $this->responseAttachments[] = $info;
00251                                 }
00252                         }
00253                 
00254                         if (isset($return)) {
00255                                 $this->responseData = $root;
00256                                 return $return;
00257                         }
00258                         
00259                         $this->setError('No root part found in multipart/related content');
00260                         return '';
00261                 }
00262                 $this->debug('Not multipart/related');
00263                 return parent::parseResponse($headers, $data);
00264         }

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


Dokumentation der Datenelemente

nusoap_client_mime::$mimeContentType

Definiert in Zeile 71 der Datei nusoapmime.php.

nusoap_client_mime::$requestAttachments = array()

Definiert in Zeile 60 der Datei nusoapmime.php.

nusoap_client_mime::$responseAttachments

Definiert in Zeile 66 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