ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
nusoapservermime Class Reference

nusoapservermime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments. More...

+ Inheritance diagram for nusoapservermime:
+ Collaboration diagram for nusoapservermime:

Public Member Functions

 addAttachment ($data, $filename= '', $contenttype= 'application/octet-stream', $cid=false)
 adds a MIME attachment to the current response.
 clearAttachments ()
 clears the MIME attachments for the current response.
 getAttachments ()
 gets the MIME attachments from the current request.
 getHTTPBody ($soapmsg)
 gets the HTTP body for the current response.
 getHTTPContentType ()
 gets the HTTP content type for the current response.
 getHTTPContentTypeCharset ()
 gets the HTTP content type charset for the current response.
 parseRequest ($headers, $data)
 processes SOAP message received from client
- Public Member Functions inherited from soap_server
 soap_server ($wsdl=false)
 
constructor

the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.

 service ($data)
 processes request and returns response
 parse_http_headers ()
 parses HTTP request headers.
 parse_request ($data='')
 parses a request
 invoke_method ()
 invokes a PHP function for the requested SOAP method
 serialize_return ()
 serializes the return value from a PHP function into a full SOAP Envelope
 send_response ()
 sends an HTTP response
 verify_method ($operation, $request)
 takes the value that was created by parsing the request and compares to the method's signature, if available.
 add_to_map ($methodname, $in, $out)
 add a method to the dispatch map
 register ($name, $in=false, $out=false, $namespace=false, $soapaction=false, $style=false, $use=false, $documentation='')
 register a service with the server
 fault ($faultcode, $faultstring, $faultactor='', $faultdetail='')
 create a fault.
 webDescription ()
 prints html description of services
 configureWSDL ($serviceName, $namespace=false, $endpoint=false, $style='rpc', $transport= 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace=false)
 sets up wsdl object this acts as a flag to enable internal WSDL generation
 soap_server ($wsdl=false)
 
constructor

the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.

 service ($data)
 processes request and returns response
 parse_http_headers ()
 parses HTTP request headers.
 parse_request ($data='')
 parses a request
 invoke_method ()
 invokes a PHP function for the requested SOAP method
 serialize_return ()
 serializes the return value from a PHP function into a full SOAP Envelope
 send_response ()
 sends an HTTP response
 verify_method ($operation, $request)
 takes the value that was created by parsing the request and compares to the method's signature, if available.
 add_to_map ($methodname, $in, $out)
 add a method to the dispatch map (this has been replaced by the register method)
 register ($name, $in=array(), $out=array(), $namespace=false, $soapaction=false, $style=false, $use=false, $documentation='', $encodingStyle='')
 register a service function with the server
 fault ($faultcode, $faultstring, $faultactor='', $faultdetail='')
 Specify a fault to be returned to the client.
 configureWSDL ($serviceName, $namespace=false, $endpoint=false, $style='rpc', $transport= 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace=false)
 Sets up wsdl object.
 soap_server ($wsdl=false)
 
constructor

the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.

 service ($data)
 processes request and returns response
 parse_http_headers ()
 parses HTTP request headers.
 parse_request ($data='')
 parses a request
 invoke_method ()
 invokes a PHP function for the requested SOAP method
 serialize_return ()
 serializes the return value from a PHP function into a full SOAP Envelope
 send_response ()
 sends an HTTP response
 verify_method ($operation, $request)
 takes the value that was created by parsing the request and compares to the method's signature, if available.
 add_to_map ($methodname, $in, $out)
 add a method to the dispatch map (this has been replaced by the register method)
 register ($name, $in=array(), $out=array(), $namespace=false, $soapaction=false, $style=false, $use=false, $documentation='', $encodingStyle='')
 register a service function with the server
 fault ($faultcode, $faultstring, $faultactor='', $faultdetail='')
 Specify a fault to be returned to the client.
 configureWSDL ($serviceName, $namespace=false, $endpoint=false, $style='rpc', $transport= 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace=false)
 Sets up wsdl object.
- Public Member Functions inherited from nusoap_server
 nusoap_server ($wsdl=false)
 
constructor

the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.

 nusoap_server ($wsdl=false)
 
constructor

the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.

- Public Member Functions inherited from nusoap_base
 debug ($string)
 adds debug data to the class level debug string
 expandEntities ($val)
 expands entities, e.g.
 getError ()
 returns error string if present
 setError ($str)
 sets error string
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array)
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
 serializes PHP values in accordance w/ section 5.
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded')
 serialize message
 formatDump ($str)
 contractQname ($qname)
 contracts a qualified name
 expandQname ($qname)
 expands a qualified name
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace returns false if no namespace registered with the given prefix
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace
 varDump ($data)
 nusoap_base ()
 constructor
 getGlobalDebugLevel ()
 gets the global debug level, which applies to future instances
 setGlobalDebugLevel ($level)
 sets the global debug level, which applies to future instances
 getDebugLevel ()
 gets the debug level for this instance
 setDebugLevel ($level)
 sets the debug level for this instance
 debug ($string)
 adds debug data to the instance debug string with formatting
 appendDebug ($string)
 adds debug data to the instance debug string without formatting
 clearDebug ()
 clears the current debug data for this instance
getDebug ()
 gets the current debug data for this instance
getDebugAsXMLComment ()
 gets the current debug data for this instance as an XML comment this may change the contents of the debug data
 expandEntities ($val)
 expands entities, e.g.
 getError ()
 returns error string if present
 setError ($str)
 sets error string
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array)
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
 serializes PHP values in accordance w/ section 5.
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded', $encodingStyle='http://schemas.xmlsoap.org/soap/encoding/')
 serializes a message
 formatDump ($str)
 formats a string to be inserted into an HTML stream
 contractQname ($qname)
 contracts (changes namespace to prefix) a qualified name
 expandQname ($qname)
 expands (changes prefix to namespace) a qualified name
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace
 getmicrotime ()
 returns the time in ODBC canonical form with microseconds
 varDump ($data)
 Returns a string with the output of var_dump.
 nusoap_base ()
 constructor
 getGlobalDebugLevel ()
 gets the global debug level, which applies to future instances
 setGlobalDebugLevel ($level)
 sets the global debug level, which applies to future instances
 getDebugLevel ()
 gets the debug level for this instance
 setDebugLevel ($level)
 sets the debug level for this instance
 debug ($string)
 adds debug data to the instance debug string with formatting
 appendDebug ($string)
 adds debug data to the instance debug string without formatting
 clearDebug ()
 clears the current debug data for this instance
getDebug ()
 gets the current debug data for this instance
getDebugAsXMLComment ()
 gets the current debug data for this instance as an XML comment this may change the contents of the debug data
 expandEntities ($val)
 expands entities, e.g.
 getError ()
 returns error string if present
 setError ($str)
 sets error string
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array)
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
 serializes PHP values in accordance w/ section 5.
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded', $encodingStyle='http://schemas.xmlsoap.org/soap/encoding/')
 serializes a message
 formatDump ($str)
 formats a string to be inserted into an HTML stream
 contractQname ($qname)
 contracts (changes namespace to prefix) a qualified name
 expandQname ($qname)
 expands (changes prefix to namespace) a qualified name
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace
 getmicrotime ()
 returns the time in ODBC canonical form with microseconds
 varDump ($data)
 Returns a string with the output of var_dump.
 nusoap_base ()
 constructor
 getGlobalDebugLevel ()
 gets the global debug level, which applies to future instances
 setGlobalDebugLevel ($level)
 sets the global debug level, which applies to future instances
 getDebugLevel ()
 gets the debug level for this instance
 setDebugLevel ($level)
 sets the debug level for this instance
 debug ($string)
 adds debug data to the instance debug string with formatting
 appendDebug ($string)
 adds debug data to the instance debug string without formatting
 clearDebug ()
 clears the current debug data for this instance
getDebug ()
 gets the current debug data for this instance
getDebugAsXMLComment ()
 gets the current debug data for this instance as an XML comment this may change the contents of the debug data
 expandEntities ($val)
 expands entities, e.g.
 getError ()
 returns error string if present
 setError ($str)
 sets error string
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array)
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded', $soapval=false)
 serializes PHP values in accordance w/ section 5.
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded', $encodingStyle='http://schemas.xmlsoap.org/soap/encoding/')
 serializes a message
 formatDump ($str)
 formats a string to be inserted into an HTML stream
 contractQname ($qname)
 contracts (changes namespace to prefix) a qualified name
 expandQname ($qname)
 expands (changes prefix to namespace) a qualified name
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace
 getmicrotime ()
 returns the time in ODBC canonical form with microseconds
 varDump ($data)
 Returns a string with the output of var_dump.
 __toString ()
 represents the object as a string
 nusoap_base ()
 constructor
 getGlobalDebugLevel ()
 gets the global debug level, which applies to future instances
 setGlobalDebugLevel ($level)
 sets the global debug level, which applies to future instances
 getDebugLevel ()
 gets the debug level for this instance
 setDebugLevel ($level)
 sets the debug level for this instance
 debug ($string)
 adds debug data to the instance debug string with formatting
 appendDebug ($string)
 adds debug data to the instance debug string without formatting
 clearDebug ()
 clears the current debug data for this instance
getDebug ()
 gets the current debug data for this instance
getDebugAsXMLComment ()
 gets the current debug data for this instance as an XML comment this may change the contents of the debug data
 expandEntities ($val)
 expands entities, e.g.
 getError ()
 returns error string if present
 setError ($str)
 sets error string
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array)
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded', $soapval=false)
 serializes PHP values in accordance w/ section 5.
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded', $encodingStyle='http://schemas.xmlsoap.org/soap/encoding/')
 serializes a message
 formatDump ($str)
 formats a string to be inserted into an HTML stream
 contractQname ($qname)
 contracts (changes namespace to prefix) a qualified name
 expandQname ($qname)
 expands (changes prefix to namespace) a qualified name
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace
 getmicrotime ()
 returns the time in ODBC canonical form with microseconds
 varDump ($data)
 Returns a string with the output of var_dump.
 __toString ()
 represents the object as a string

Data Fields

 $requestAttachments = array()
 $responseAttachments
 $mimeContentType
- Data Fields inherited from nusoap_server_mime
 $requestAttachments = array()
 $responseAttachments
 $mimeContentType
- Data Fields inherited from nusoap_server
 $headers = array()
 $request = ''
 $requestHeaders = ''
 $requestHeader = NULL
 $document = ''
 $requestSOAP = ''
 $methodURI = ''
 $methodname = ''
 $methodparams = array()
 $SOAPAction = ''
 $xml_encoding = ''
 $decode_utf8 = true
 $outgoing_headers = array()
 $response = ''
 $responseHeaders = ''
 $responseSOAP = ''
 $methodreturn = false
 $methodreturnisliteralxml = false
 $fault = false
 $result = 'successful'
 $operations = array()
 $wsdl = false
 $externalWSDLURL = false
 $debug_flag = false
- Data Fields inherited from nusoap_base
 $title = 'NuSOAP'
 $version = '0.6.7'
 $revision = '$Revision: 11808 $'
 $error_str = false
 $debug_str = ''
 $charencoding = true
 $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 $soap_defencoding = 'UTF-8'
 $namespaces
 $usedNamespaces = array()
 $typemap
 $xmlEntities
 $debugLevel
- Data Fields inherited from soap_server
 $headers = array()
 $request = ''
 $requestHeaders = ''
 $document = ''
 $requestSOAP = ''
 $methodURI = ''
 $methodname = ''
 $methodparams = array()
 $xml_encoding = ''
 $SOAPAction = ''
 $outgoing_headers = array()
 $response = ''
 $responseHeaders = ''
 $responseSOAP = ''
 $methodreturn = false
 $methodreturnisliteralxml = false
 $fault = false
 $result = 'successful'
 $operations = array()
 $wsdl = false
 $externalWSDLURL = false
 $debug_flag = false
 $decode_utf8 = true

Detailed Description

nusoapservermime server supporting MIME attachments defined at http://www.w3.org/TR/SOAP-attachments.

It depends on the PEAR Mail_MIME library.

Author
Scott Nichol snich.nosp@m.ol@s.nosp@m.ource.nosp@m.forg.nosp@m.e.net
Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
Version
Id:
nusoapmime.php 14918 2007-10-07 17:02:40Z rkuester

public

Definition at line 268 of file nusoapmime.php.

Member Function Documentation

nusoapservermime::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.

Parameters
string$dataThe data of the attachment
string$filenameThe filename of the attachment (default is empty string)
string$contenttypeThe MIME Content-Type of the attachment (default is application/octet-stream)
string$cidThe content-id (cid) of the attachment (default is false)
Returns
string The content-id (cid) of the attachment public

Reimplemented from nusoap_server_mime.

Definition at line 302 of file nusoapmime.php.

References $cid, $data, and $filename.

{
if (! $cid) {
$cid = md5(uniqid(time()));
}
$info['data'] = $data;
$info['filename'] = $filename;
$info['contenttype'] = $contenttype;
$info['cid'] = $cid;
$this->responseAttachments[] = $info;
return $cid;
}
nusoapservermime::clearAttachments ( )

clears the MIME attachments for the current response.

public

Reimplemented from nusoap_server_mime.

Definition at line 322 of file nusoapmime.php.

{
$this->responseAttachments = array();
}
nusoapservermime::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.

Returns
array The attachments. public

Reimplemented from nusoap_server_mime.

Definition at line 336 of file nusoapmime.php.

References $requestAttachments.

nusoapservermime::getHTTPBody (   $soapmsg)

gets the HTTP body for the current response.

Parameters
string$soapmsgThe SOAP payload
Returns
string The HTTP body, which includes the SOAP payload private

Reimplemented from soap_server.

Definition at line 347 of file nusoapmime.php.

References $data, $params, nusoap_base\$soap_defencoding, and nusoap_base\debug().

{
if (count($this->responseAttachments) > 0) {
$params['content_type'] = 'multipart/related; type=text/xml';
$mimeMessage =& new Mail_mimePart('', $params);
unset($params);
$params['content_type'] = 'text/xml';
$params['encoding'] = '8bit';
$mimeMessage->addSubpart($soapmsg, $params);
foreach ($this->responseAttachments as $att) {
unset($params);
$params['content_type'] = $att['contenttype'];
$params['encoding'] = 'base64';
$params['disposition'] = 'attachment';
$params['dfilename'] = $att['filename'];
$params['cid'] = $att['cid'];
if ($att['data'] == '' && $att['filename'] <> '') {
if ($fd = fopen($att['filename'], 'rb')) {
$data = fread($fd, filesize($att['filename']));
fclose($fd);
} else {
$data = '';
}
$mimeMessage->addSubpart($data, $params);
} else {
$mimeMessage->addSubpart($att['data'], $params);
}
}
$output = $mimeMessage->encode();
$mimeHeaders = $output['headers'];
foreach ($mimeHeaders as $k => $v) {
$this->debug("MIME header $k: $v");
if (strtolower($k) == 'content-type') {
// PHP header() seems to strip leading whitespace starting
// the second line, so force everything to one line
$this->mimeContentType = str_replace("\r\n", " ", $v);
}
}
return $output['body'];
}
return parent::getHTTPBody($soapmsg);
}

+ Here is the call graph for this function:

nusoapservermime::getHTTPContentType ( )

gets the HTTP content type for the current response.

Note: getHTTPBody must be called before this.

Returns
string the HTTP content type for the current response. private

Reimplemented from soap_server.

Definition at line 406 of file nusoapmime.php.

References $mimeContentType.

{
if (count($this->responseAttachments) > 0) {
}
}
nusoapservermime::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.

Returns
string the HTTP content type charset for the current response. private

Reimplemented from soap_server.

Definition at line 422 of file nusoapmime.php.

{
if (count($this->responseAttachments) > 0) {
return false;
}
}
nusoapservermime::parseRequest (   $headers,
  $data 
)

processes SOAP message received from client

Parameters
array$headersThe HTTP headers
string$dataunprocessed request data from client
Returns
mixed value of the message, decoded into a PHP type private

Reimplemented from soap_server.

Definition at line 437 of file nusoapmime.php.

References $data, soap_server\$headers, $params, nusoap_base\debug(), and nusoap_base\setError().

{
$this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
$this->requestAttachments = array();
if (strstr($headers['content-type'], 'multipart/related')) {
$this->debug('Decode multipart/related');
$input = '';
foreach ($headers as $k => $v) {
$input .= "$k: $v\r\n";
}
$params['input'] = $input . "\r\n" . $data;
$params['include_bodies'] = true;
$params['decode_bodies'] = true;
$params['decode_headers'] = true;
$structure = Mail_mimeDecode::decode($params);
foreach ($structure->parts as $part) {
if (!isset($part->disposition)) {
$this->debug('Have root part of type ' . $part->headers['content-type']);
$return = parent::parseRequest($part->headers, $part->body);
} else {
$this->debug('Have an attachment of type ' . $part->headers['content-type']);
$info['data'] = $part->body;
$info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
$info['contenttype'] = $part->headers['content-type'];
$info['cid'] = $part->headers['content-id'];
$this->requestAttachments[] = $info;
}
}
if (isset($return)) {
return $return;
}
$this->setError('No root part found in multipart/related content');
return;
}
$this->debug('Not multipart/related');
}

+ Here is the call graph for this function:

Field Documentation

nusoapservermime::$mimeContentType

Definition at line 285 of file nusoapmime.php.

Referenced by getHTTPContentType().

nusoapservermime::$requestAttachments = array()

Definition at line 274 of file nusoapmime.php.

Referenced by getAttachments().

nusoapservermime::$responseAttachments

Definition at line 280 of file nusoapmime.php.


The documentation for this class was generated from the following file: