ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
soap_clientmime Class Reference

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

+ Inheritance diagram for soap_clientmime:
+ Collaboration diagram for soap_clientmime:

Public Member Functions

 addAttachment ($data, $filename= '', $contenttype= 'application/octet-stream', $cid=false)
 adds a MIME attachment to the current request.
 clearAttachments ()
 clears the MIME attachments for the current request.
 getAttachments ()
 gets the MIME attachments from the current response.
 getHTTPBody ($soapmsg)
 gets the HTTP body for the current request.
 getHTTPContentType ()
 gets the HTTP content type for the current request.
 getHTTPContentTypeCharset ()
 gets the HTTP content type charset for the current request.
 parseResponse ($headers, $data)
 processes SOAP message returned from server
- Public Member Functions inherited from soap_client
 soap_client ($endpoint, $wsdl=false, $proxyhost=false, $proxyport=false, $proxyusername=false, $proxypassword=false, $timeout=0, $response_timeout=30)
 constructor
 call ($operation, $params=array(), $namespace='', $soapAction='', $headers=false, $rpcParams=null, $style='rpc', $use='encoded')
 calls method, returns PHP native type
 getOperationData ($operation)
 get available data pertaining to an operation
 send ($msg, $soapaction= '', $timeout=0, $response_timeout=30)
 send the SOAP message
 setHeaders ($headers)
 set the SOAP headers
 getHeaders ()
 get the response headers
 setHTTPProxy ($proxyhost, $proxyport, $proxyusername= '', $proxypassword= '')
 set proxy info here
 setCredentials ($username, $password, $authtype= 'basic')
 if authenticating, set user credentials here
 setHTTPEncoding ($enc='gzip, deflate')
 use HTTP encoding
 useHTTPPersistentConnection ()
 use HTTP persistent connections if possible
 getDefaultRpcParams ()
 gets the default RPC parameter setting.
 setDefaultRpcParams ($rpcParams)
 sets the default RPC parameter setting.
 getProxy ()
 dynamically creates proxy class, allowing user to directly call methods from wsdl
 decodeUTF8 ($bool)
 soap_client ($endpoint, $wsdl=false, $proxyhost=false, $proxyport=false, $proxyusername=false, $proxypassword=false, $timeout=0, $response_timeout=30)
 constructor
 call ($operation, $params=array(), $namespace='http://tempuri.org', $soapAction='', $headers=false, $rpcParams=null, $style='rpc', $use='encoded')
 calls method, returns PHP native type
 getOperationData ($operation)
 get available data pertaining to an operation
 send ($msg, $soapaction= '', $timeout=0, $response_timeout=30)
 send the SOAP message
 setEndpoint ($endpoint)
 sets the SOAP endpoint, which can override WSDL
 setHeaders ($headers)
 set the SOAP headers
 getHeaders ()
 get the SOAP response headers (namespace resolution incomplete)
 setHTTPProxy ($proxyhost, $proxyport, $proxyusername= '', $proxypassword= '')
 set proxy info here
 setCredentials ($username, $password, $authtype= 'basic', $certRequest=array())
 if authenticating, set user credentials here
 setHTTPEncoding ($enc='gzip, deflate')
 use HTTP encoding
 useHTTPPersistentConnection ()
 use HTTP persistent connections if possible
 getDefaultRpcParams ()
 gets the default RPC parameter setting.
 setDefaultRpcParams ($rpcParams)
 sets the default RPC parameter setting.
 getProxy ()
 dynamically creates an instance of a proxy class, allowing user to directly call methods from wsdl
 _getProxyClassCode ($r)
 dynamically creates proxy class code
 getProxyClassCode ()
 dynamically creates proxy class code
 decodeUTF8 ($bool)
 setCookie ($name, $value)
 adds a new Cookie into $this->cookies array
 getCookies ()
 gets all Cookies
 checkCookies ()
 checks all Cookies and delete those which are expired
 UpdateCookies ($cookies)
 updates the current cookies with a new set
 soap_client ($endpoint, $wsdl=false, $proxyhost=false, $proxyport=false, $proxyusername=false, $proxypassword=false, $timeout=0, $response_timeout=30)
 constructor
 call ($operation, $params=array(), $namespace='', $soapAction='', $headers=false, $rpcParams=null, $style='rpc', $use='encoded')
 calls method, returns PHP native type
 getOperationData ($operation)
 get available data pertaining to an operation
 send ($msg, $soapaction= '', $timeout=0, $response_timeout=30)
 send the SOAP message
 setHeaders ($headers)
 set the SOAP headers
 getHeaders ()
 get the response headers
 setHTTPProxy ($proxyhost, $proxyport, $proxyusername= '', $proxypassword= '')
 set proxy info here
 setCredentials ($username, $password, $authtype= 'basic')
 if authenticating, set user credentials here
 setHTTPEncoding ($enc='gzip, deflate')
 use HTTP encoding
 useHTTPPersistentConnection ()
 use HTTP persistent connections if possible
 getDefaultRpcParams ()
 gets the default RPC parameter setting.
 setDefaultRpcParams ($rpcParams)
 sets the default RPC parameter setting.
 getProxy ()
 dynamically creates proxy class, allowing user to directly call methods from wsdl
 decodeUTF8 ($bool)
 soap_client ($endpoint, $wsdl=false, $proxyhost=false, $proxyport=false, $proxyusername=false, $proxypassword=false, $timeout=0, $response_timeout=30)
 constructor
 call ($operation, $params=array(), $namespace='http://tempuri.org', $soapAction='', $headers=false, $rpcParams=null, $style='rpc', $use='encoded')
 calls method, returns PHP native type
 getOperationData ($operation)
 get available data pertaining to an operation
 send ($msg, $soapaction= '', $timeout=0, $response_timeout=30)
 send the SOAP message
 setEndpoint ($endpoint)
 sets the SOAP endpoint, which can override WSDL
 setHeaders ($headers)
 set the SOAP headers
 getHeaders ()
 get the SOAP response headers (namespace resolution incomplete)
 setHTTPProxy ($proxyhost, $proxyport, $proxyusername= '', $proxypassword= '')
 set proxy info here
 setCredentials ($username, $password, $authtype= 'basic', $certRequest=array())
 if authenticating, set user credentials here
 setHTTPEncoding ($enc='gzip, deflate')
 use HTTP encoding
 useHTTPPersistentConnection ()
 use HTTP persistent connections if possible
 getDefaultRpcParams ()
 gets the default RPC parameter setting.
 setDefaultRpcParams ($rpcParams)
 sets the default RPC parameter setting.
 getProxy ()
 dynamically creates an instance of a proxy class, allowing user to directly call methods from wsdl
 _getProxyClassCode ($r)
 dynamically creates proxy class code
 getProxyClassCode ()
 dynamically creates proxy class code
 decodeUTF8 ($bool)
 setCookie ($name, $value)
 adds a new Cookie into $this->cookies array
 getCookies ()
 gets all Cookies
 checkCookies ()
 checks all Cookies and delete those which are expired
 UpdateCookies ($cookies)
 updates the current cookies with a new set
- 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.

Data Fields

 $requestAttachments = array()
 $responseAttachments
 $mimeContentType
- Data Fields inherited from soap_client
 $username = ''
 $password = ''
 $authtype = ''
 $requestHeaders = false
 $responseHeaders = ''
 $document = ''
 $endpoint
 $error_str = false
 $proxyhost = ''
 $proxyport = ''
 $proxyusername = ''
 $proxypassword = ''
 $xml_encoding = ''
 $http_encoding = false
 $timeout = 0
 $response_timeout = 30
 $endpointType = ''
 $persistentConnection = false
 $defaultRpcParams = false
 $request = ''
 $response = ''
 $responseData = ''
 $decode_utf8 = true
 $fault
 $faultcode
 $faultstring
 $faultdetail
 $certRequest = array()
 $forceEndpoint = ''
 $cookies = array()
 $operations = array()
- 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

Detailed Description

soap_clientmime client 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 48 of file nusoapmime.php.

Member Function Documentation

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

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

Definition at line 82 of file nusoapmime.php.

References $data, and $filename.

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

clears the MIME attachments for the current request.

public

Definition at line 102 of file nusoapmime.php.

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

Returns
array The attachments. public

Definition at line 116 of file nusoapmime.php.

References $responseAttachments.

soap_clientmime::getHTTPBody (   $soapmsg)

gets the HTTP body for the current request.

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

Reimplemented from soap_client.

Definition at line 127 of file nusoapmime.php.

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

{
if (count($this->requestAttachments) > 0) {
$params['content_type'] = 'multipart/related; type=text/xml';
$mimeMessage =& new Mail_mimePart('', $params);
unset($params);
$params['content_type'] = 'text/xml';
$params['encoding'] = '8bit';
$params['charset'] = $this->soap_defencoding;
$mimeMessage->addSubpart($soapmsg, $params);
foreach ($this->requestAttachments 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:

soap_clientmime::getHTTPContentType ( )

gets the HTTP content type for the current request.

Note: getHTTPBody must be called before this.

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

Reimplemented from soap_client.

Definition at line 186 of file nusoapmime.php.

References $mimeContentType.

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

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

Reimplemented from soap_client.

Definition at line 202 of file nusoapmime.php.

{
if (count($this->requestAttachments) > 0) {
return false;
}
}
soap_clientmime::parseResponse (   $headers,
  $data 
)

processes SOAP message returned from server

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

Reimplemented from soap_client.

Definition at line 217 of file nusoapmime.php.

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

{
$this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
$this->responseAttachments = 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::parseResponse($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->responseAttachments[] = $info;
}
}
if (isset($return)) {
return $return;
}
$this->setError('No root part found in multipart/related content');
return;
}
$this->debug('Not multipart/related');
return parent::parseResponse($headers, $data);
}

+ Here is the call graph for this function:

Field Documentation

soap_clientmime::$mimeContentType

Definition at line 65 of file nusoapmime.php.

Referenced by getHTTPContentType().

soap_clientmime::$requestAttachments = array()

Definition at line 54 of file nusoapmime.php.

soap_clientmime::$responseAttachments

Definition at line 60 of file nusoapmime.php.

Referenced by getAttachments().


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