*** empty log message ***

This commit is contained in:
Regis Houssin
2007-07-28 11:29:09 +00:00
parent dc31ffc437
commit ddc4186387
127 changed files with 21592 additions and 21592 deletions

View File

@@ -1,438 +1,438 @@
2003-07-21, version 0.6.5
- soap_transport_http: SOAPAction header is quoted again, fixes problem w/ Weblogic Server
- applied Jason Levitt patch for proper array serialization, fixes problem w/ Amazon shopping cart services
- fixed null value serialization
- applied patch from "BZC ToOn'S" - fixes wsdl serialization when no parameters
- applied John's patch, implementing compression for the server
2003-07-22, version 0.6.5
- soap_server: fixed bug causing charset encoding not to be passed to the parser
- soap_fault: added default encoding to the fault serialization
- soap_parser: changed the parser to pre-load the parent's result array when processing scalar values. This increases parsing speed.
2003-07-23, version 0.6.5
- soap_base: fix code that overwrites user-supplied attributes in serialize_val
- soap_base: use arrays-of-arrays rather than attempting multi-dimensional in serialize_val
- xmlschema: emit import statements and qualify all elements with prefix in serializeSchema (better interop with validation tools)
- soapclient: get xml character encoding from HTTP Content-Type header if provided, e.g. text/xml;charset="UTF-8"
- soapclient: use headers in call if provided (previously ignored this parameter)
- soap_server: in parse_request, if neither getallheaders nor $_SERVER are available, use $HTTP_SERVER_VARS to get SOAPAction and xml encoding
2003-07-24, version 0.6.5
- soap_transport_http: apply patch from Steven Brown "if the server closes connection prematurely, nusoap would spin trying to read data that isn't there"
2003-07-25, version 0.6.5
- wsdl: apply patch from Sven to workaround single schema limitation
- wsdl: apply a variant of the patch from Holger to handle empty values for array by serializing an array with 0 elements
- xmlschema: remove the redundant default namespace attribute on the schema element; everything in xsd is explicitly specified as being from xsd
- soap_transport_http: fix setCredentials and add TODO comments in sendHTTPS about what to change if this setCredentials stays
2003-07-30, version 0.6.5
- nusoap_base: change documentation of soap_defencoding to specify it is the encoding for outgoing messages
- nusoap_base: only change &, <, > to entities, not all HTML entities
- soap_transport_http: update the Content-Type header in sendRequest, since soap_defencoding could be changed after ctor is called
- soap_server: use soap_defencoding instead of charset_encoding
- soap_server: read encoding from _SERVER if available
- nusoap_base: do entity translation for string parameters with an xsd type specified (thanks David Derr)
2003-07-31, version 0.6.5
- soap_transport_http: add proxy authentication
- soap_transport_http: build payload the same way for http and https
- wsdl: add proxy authentication
- soapclient: add proxy authentication
- soapclient: allow proxy information in ctor, so that it can be used for wsdl
2003-08-01, version 0.6.5
- soap_transport_http: close a persistent connection that's at EOF
- soap_transport_http: prevent conflicts between setEncoding and usePersistentConnection
- soap_transport_http: fix use of $headers instead of $this->incoming_headers in getResponse
- soapclient: improve handling of persistent connections
- soapclient: force xml_encoding to upper case
- soap_server: let the Web server decide whether to close the connection (no Connection: close header)
- soap_server: force xml_encoding to upper case
2003-08-04, version 0.6.5
- soap_parser: use XML type information to pick a PHP data type; also decode base64
- soap_server: read all HTTP headers when using _SERVER or HTTP_SERVER_VARS
- soap_server: add gzip encoding support for outgoing messages
- soap_transport_http: deflate is gzcompress/gzuncompress (cf. http://archive.develooper.com/libwww@perl.org/msg04650.html)
- soap_transport_http: clean use of persistentConnection so it's always a set boolean
- soapclient: add responseData member to access deflated/gunzipped payload
2003-08-05, version 0.6.5
- soap_server: look multiple places when setting debug_flag
2003-08-07, version 0.6.5
- nusoap_base: serialize specified type (e.g. ArrayOfString) even for simple array
- wsdl: only specify encodingStyle in the input/output soap bindings when it is not empty (thanks Guillaume)
2003-08-15, version 0.6.5
- soap_parser: fix parsing of elements with no XSD type specified
- soap_parser: use PHP string type for XSD long and unsignedLong types
2003-08-16, version 0.6.5
- soap_parser: fix code generating warning (thanks Torsten)
2003-08-19, version 0.6.5
- soap_parser: fix another line of code generating a warning (thanks Torsten)
2003-08-22, version 0.6.5
- soap_server: remove all '--' from debug_str; previous code changed '---' to '- --'
- wsdl, soapclient, soap_parser: patch submitted by Mark Spavin as described by
the following...
> Changes for the multiple/nested imports from the wsdl file. This builds an
> array of files not just the last one and also checks for relative paths to
> the parent. This will then get the imported files from the remote site
> instead of your local disk. Local wsdl files should still work (untested).
>
> Changes for multiple encoding sytles as previously posted
2003-08-24, version 0.6.5
- wsdl, soapclient: fix some PHP notices from previous update
2003-08-26, version 0.6.5
- wsdl: support multiple SOAP ports
- soapclient, soap_server: when no charset is specified, use UTF-8, even though HTTP specifies US-ASCII.
- soap_transport_http: do not prepend $host with 'ssl://' for https (is this required for older cURL versions?)
2003-08-27, version 0.6.5
- soap_server: support compressed request messages (thanks John Huong)
- soap_parser: deserialize Apache Vector as an array
- xmlschema: use $this->typemap in getPHPType (which is not used)
- soapclient, wsdl: check for WSDL errors after serializing parameters
- nusoap_base: add serialization of Apache Map (when not using WSDL)
- wsdl: add serialization of Apache Map (when using WSDL)
- wsdl: only change &, <, > to entities, not all HTML entities
2003-08-28, version 0.6.5
- soap_transport_http: disable cURL verification of peer and server (formerly the cURL default)
- soap_transport_http: mingle cURL code with straight http, so sendHTTP is no longer needed
2003-08-29, version 0.6.6
- soap_transport_http: add setContentType
- soapclient: call setContentType using new getHTTPContentType and getHTTPContentTypeCharset
2003-09-05, version 0.6.6
- wsdl: add some more code to handle null/nil values (but there's still a way to go)
2003-10-21, version 0.6.6
- soap_transport_http: only include port in Host header if it was specified in the URL
- soap_transport_http: add some code to use OpenSSL for PHP ssl:// scheme, but comment out since it's not ready
- soap_server: use $_SERVER['PHP_SELF'] if $GLOBALS['PHP_SELF'] is not set
- wsdl: add WSDL request and response and transport debug to debug
- wsdl: handle custom type extending xmlschema namespace (GLUE ... Thanks Matt)
- soap_parser: add param to docs
- soapclient: add getHTTPBody, getHTTPContentType, getHTTPContentTypeCharset (anticipating MIME subclass)
2003-10-28, version 0.6.6
- nusoap_base: add expandEntities method
- wsdl: use expandEntities
- soap_fault: use expandEntities
- soap_transport_http: Allow credentials to be included in URL, rather than requiring setCredentials
- soap_transport_http: Merge HTTP headers that span multiple lines
- soap_parser: Properly set errors in ctor
- soapclient: Pass headers to parseResponse and parse them in that method
2003-10-30, version 0.6.6
- xmlschema: Add some information for the related type to an element
2003-12-09, version 0.6.6
- nusoap_base: Add some namespace methods previously in xmlschema
- xmlschema: Improve parsing of complexType, element and simpleType
- xmlschema: Improve serialization
- xmlschema: Track imports
- xmlschema: Track elementFormDefault and form attributes
- wsdl: Support multiple <schema> (note that setting $server->wsdl->schemaTargetNamespace no longer does anything! Use configureWSDL instead.)
- wsdl: Use form attribute of element to control namespace specification
- wsdl: Support chained imports (A imports B which imports C)
- wsdl: Include port in endpoint address when serializing
- soap_server: Fix use of style (rpc|document) and use (encoded|literal)
- soap_server: Support _SERVER[CONTENT_TYPE] in addition to _SERVER[HTTP_CONTENT_TYPE]
- soap_server: Support wsdl with multiple <schema>
- soap_client: Remove a var_dump
- soap_client: Add style and use parameters to call method to support doc/lit without WSDL
- soap_transport_http: Check that $this->fp exists when doing persistent connections
2003-12-17, version 0.6.6
- soap_server: pass namespaces to xmlschema constructor
- wsdl: post-process after all imports
- wsdl: remove some debug, add some error handling
- xmlschema: allow enclosing namespaces to be specified in constructor
- xmlschema: improve handling of compositors and simple types
2004-01-08, version 0.6.6
- soap_server: when requested WSDL is in a file, return to client using passthru (thanks Ingo Fischer)
- soapclient: have proxy inherit more client state
- soapclient: allow timeout and response timeout to be specified in the constructor
- wsdl: allow timeout and response timeout to be specified in the constructor
- soap_transport_http: allow response timeout to be specified in send and sendHTTPS
2004-01-28, version 0.6.6
- wsdl: add namespace for array and scalar when form is qualified
- wsdl: fix a bug in which data type of complexType elements were ignored in serialization
- wsdl: enhance handling of URLs with file scheme
- wsdl: add addSimpleType
- xmlschema: add addSimpleType
- xmlschema: always set phpType elements
- soapclient: allow a wsdl instance to be specified in constructor
- soap_server: allow a wsdl instance to be specified in constructor (not tested!)
- soap_server: fix default SOAPAction created in register method
- soap_transport_http: accept chunking with LF separators in addition to CRLF.
- wsdlcache: added class
- nusoapmime: fix comments
2004-02-23, version 0.6.6
- soap_transport_http: don't try to unchunk cURL data, since cURL already does it
- soap_transport_http: append CVS revision to version in User-Agent
- wsdl: serialize boolean as true|false, not 1|0, to agree with XML Schema
- soap_server: always exit() after returning WSDL
- soap_server: use the WSDL URL scheme as the default endpoint URL scheme
- soap_server: append CVS revision to version in X-SOAP-Server
- nusoap_base: add (CVS) revision
- wsdlcache: synchronize using a per-WSDL lock file (Thanks Ingo)
- wsdlcache: add cache lifetime, after which cache contents are invalidated (Thanks Ingo)
2004-03-15, version 0.6.6
- nusoap_base: add isArraySimpleOrStruct method
- soap_server: improve WSDL URL scheme determination
- soap_server: only deflate/gzip payloads > 1024 bytes
- soap_server: fix parameter order in fault method (always used as faultcode, faultstring)
- soap_server: refactor parse_request into multiple functions (for sanity)
- soap_server: set the namespace on the Response element to the same as the request
- soap_server: name the return value element 'return' by default
- soap_server: added and documented data fields, so that service programmers can use them if desired
- soap_parser: standardize parsing error message
- soap_parser: fix document and responseHeaders so they are the correct XML text (as documented)
- soap_transport_http: fix read from persistent connection
- soapclient: clean up debugging for persistent connection
- wsdl: enforce correct naming of messages parts when an associative array is used for parameters
- wsdl: better serialization of null values
- wsdl: standardize parsing error message
- xmlschema: standardize parsing error message
2004-03-24, version 0.6.7
- soap_transport_http: add digest authentication (based on code by Kevin A. Miller)
- xmlschema: improve parsing of import elements
- wsdl: do schema imports even if there are no wsdl imports
2004-04-12, version 0.6.7
- wsdl: serialize multiple elements when maxOccurs="unbounded" and value is an array
- wsdl: serialize soapval values (used to force an XML type, e.g. when WSDL uses an abstract type)
- nusoapmime: do not require nusoap.php (it is now the programmer's responsibility)
2004-04-21, version 0.6.7
- soap_parser: parse repeated element name into an array (de-serializes doc/lit array into a PHP array when there is more than 1 array element)
- soap_server: do not wrap response in a response element for a document style service
2004-04-30, version 0.6.7
- soap_transport_http: allow digest auth params to be separated by "," as well as ", "
- soap_transport_http: re-initialize incoming headers for each response
- soap_server: add methodreturnisliteralxml property to allow service function to return XML as a string
- soapclient: improve rpc/literal support
- soapclient: allow XML string as call params in addition to array
- soapclient: support document style and literal encoding when not using WSDL
2004-05-05, version 0.6.7
- wsdl: serialize PHP objects for WSDL XML Schema complexTypes, in addition to associative arrays
- wsdl: fix WSDL generation when there is no encodingStyle
- soap_transport_http: suppress fsockopen warnings
- soap_transport_http: detect socket timeouts when reading (0 bytes returned)
- soap_transport_http: read chunked content "in-line" so it works on a persistent connection
- nusoap_base: serialize boolean as true|false, not 1|0, to agree with XML Schema
- nusoap_base: serialize array of struct differently than array of array
2004-06-25, version 0.6.8
- soap_server: prefer gzip to deflate, since IE does not like our deflate
- soap_server: move webDescription to the wsdl class
- soap_server: allow class and instance method calls for service (thanks Ingo Fischer and Roland Knall)
- wsdl: get webDescription from the soap_server class
- wsdl: allow compression from the server
- wsdl: fix serialization of soapval without a type
- wsdl: propagate debug value from query string to SOAP endpoint in programmatic WSDL generation
- nusoap_base: add anyType, anySimpleType for 2001 XML Schema
- nusoap_base: provide additional debug functions
- soap_transport_http: ignore Content-Length when chunked encoding is used
- soap_transport_http: remove ':' from username for Basic authentication (cf. RFC 2617)
- soap_transport_http: urldecode username and password taken from URL
- soap_transport_http: use raw inflate/deflate for IE/IIS compatibility, rather than having Zlib headers according to HTTP 1.1 spec
- soap_transport_http: attempt to handle the case when both the service application and Web server compress the response
- soapclient: when creating proxy methods, replace '.' in operation name with '__' in function name
- soapclient: initialize requestHeaders in proxy
- general: use new debug methods; never access debug_str directly
2004-09-30, version 0.6.8
- soapclient: do not allow getProxy call when WSDL is not used
- soapclient: use ISO-8859-1 as the charset if not specified in the Content-Type header
- soapclient: when an empty string is specified for the call namespace, do not put the method element in a namespace
- soapclient: let soap_transport_http check for SSL support
- soapclient: have proxy inherit soap_defencoding from the client from which it is generated
- soapclient: do not assume that 'ns1' is an unused namespace prefix; always generate namespace prefixes randomly
- soap_parser: compare any encoding in the XML declaration to the charset from the HTTP Content-Type header (thanks Ingo Fischer)
- soap_parser: improve parse repeated element name into an array (de-serializes doc/lit array into a PHP array when there is more than 1 array element)
- soap_server: use ISO-8859-1 as the charset if not specified in the Content-Type header
- soap_server: allow suppression of automatic UTF-8 decoding
- soap_server: fix a bug when call_user_func_array() is used
- soap_transport_http: correct digest authentication through a proxy
- wsdl: serialize SOAP-ENC types similarly to XSD types
- xmlschema: force unprefixed type into default namespace
- xmlschema: fix serialization of definition of simple types
2004-10-01, version 0.6.8
- soap_parser: handle default namespace attributes
- soap_server: add default_utf8 field
- soap_server: support literal encoding (with RPC style)
- soap_transport_http: parse HTTP status and generate error for 300, 302-307, 400, 401-417, 501-505 (thanks for the idea Ghislain)
- soap_transport_http: follow HTTP redirection (HTTP status 301 and Location header) (thanks for the idea Ghislain)
- xmlschema: allow any attributes to be specified in an element of a complexType, e.g., abstract, default, form, minOccurs, maxOccurs, nillable (thanks Jirka Pech for the original patch)
2004-10-02, version 0.6.8
- soapclient: read/write cookies (thanks Ingo)
- soap_server: change faultcode on non-resendable faults to Client
- soap_transport_http: read/write cookies (thanks Ingo)
2004-10-05, version 0.6.8
- wsdl: add addElement method
- wsdl: support the document style in the register method
- xmlschema: parse unnamed simpleTypes, rather than ignoring them
- xmlschema: include untyped elements when parsing a complexType
- xmlschema: add addElement method
2004-10-14, version 0.6.8
- soapclient: support client certificates
- soap_parser: deserialize attributes, prefixing names with "!"
- soap_server: notify the client with HTML when WSDL is requested but not supported by service
- soap_transport_http: support client certificates
- wsdl: support defaults for elements of a complexType
- wsdl: serialize elements from complexType extension base
- wsdl: serialize data (associative array elements) as attributes according to XML Schema
- xmlschema: record extension base if present for a complexType
2004-12-15, version 0.6.8
- nusoap_base: add 2000 XML Schema (rare, but used by Akamai)
- soap_parser: avoid deserializing more common attributes that are not data
- soap_parser: be lax when HTTP specifies ISO-8859-1 (the default) and XML specifies UTF-8 (the norm)
- soap_server: account for the fact that get_class_methods returns methods in all lower case (thanks Steve Haldane)
- soap_transport_http: parse digest info that includes '=' in the data (thanks Jinsuk Kim)
- wsdl: feably handle some cases for literal serialization of form="unqualified" elements
- wsdl: don't serialize the decimal portion of a PHP double when the XML type is long
- wsdl: fix serialization of attributes for complexType that is an extension
- wsdlcache: enhance diagnostics
- xmlschema: handle untyped elements
- xmlschema: handle WSDL for SOAP Array that uses the base attribute plus a sequence of element
2005-01-22, version 0.6.8
- wsdl: allow an element in one schema to have a type from another schema
2005-01-24, version 0.6.8
- xmlschema: correctly parse nested complexType definitions
2005-02-14, version 0.6.8
- nusoap_base: fix a bug in which attributes were sometimes not serialized with a value
- nusoap_base: improve serialization of null values (thanks Dominique Stender)
- soap_parser: parse null values by handling the nil attribute (thanks Dominique Stender)
- soap_server: set character encoding for a fault to be the same as for the server (thanks Mark Scott)
- soap_server: correctly check for null value returned from method when WSDL is used (without WSDL, cannot distinguish whether NULL or void return is desired)
- soapclient: for document style, call should always return an array rooted at the response part (all bets are off when there are multiple parts)
- xmlschema: save enumeration values parsed from WSDL
2005-02-10, version 0.6.9
- soapclient: only set SOAP headers when they are specified in call params (so setHeaders still works)
2005-04-04, version 0.6.9
- soap_server: use get_class instead of is_a (thanks Thomas Noel)
- soapclient: use get_class instead of is_a (thanks Thomas Noel)
- soapclient: add setEndpoint method
- soap_transport_http: fix client certificates (thanks Doug Anarino and Eryan Eriobowo)
2005-04-29, version 0.6.9
- nusoap_base: add global variable and methods for setting debug level
- nusoap_base: use xsd:anyType instead of xsd:ur-type to serialize arrays with multiple element types (thanks Ingo Fischer)
- nusoap_base: expand entities in attributes (thanks Gaetano Giunta)
- soapclient: call parent constructor
- soapval: call parent constructor
- soap_fault: call parent constructor
- soap_parser: call parent constructor
- soap_server: assume get_class_methods always returns lower case for PHP 4.x only
- soap_server: call parent constructor
- soap_transport_http: do nothing in setEncoding if gzdeflate is not present (thanks Franck Touanen for pointing this out)
- soap_transport_http: fix check for server request for digest authentication (thanks Mark Spavin)
- soap_transport_http: call parent constructor
- wsdl: fix documentation page popup of one method after another (thanks Owen)
- wsdl: call parent constructor
- wsdl: expand entities in attributes (thanks Gaetano Giunta)
- xmlschema: call parent constructor
2005-06-03, version 0.6.9
- nusoap_base: serialize empty arrays as having elements xsd:anyType[0]
- nusoap_base: add encodingStyle parameter to serializeEnvelope
- nusoap_base: serialize xsi:type with nil values
- nusoap_base: improve debug and comments
- soap_parser: correctly parse an empty array to an empty array, not an empty string
- soap_parser: improve debug and comments
- soap_server: specify encodingStyle for envelope when WSDL is used
- soapclient: factor out new getProxyClassCode method
- soapclient: specify encodingStyle for envelope
- soapclient: improve debug and comments
- wsdl: add namespace for Apache SOAP types if a variable of such type is serialized
- wsdl: serialize nil value for nillable elements when no value is provided
- wsdl: serialize xsi:type with nil values
- wsdl: copy attributes as well as elements to an element from its complexType
- wsdl: specify encodingStyle for operations
- wsdl: improve debug and comments
- xmlschema: improve debug and comments
2005-06-03, version 0.7.0
- nusoap_base: improve debug and comments
- nusoap_base: fix version, which should have been 0.7.0 since 2005-03-04
2005-06-06, version 0.7.1
- nusoap_base: adjust numeric element names for serialization, instead of forcing them to 'soapVal'
- nusoapmime: add type=text/xml to multipart/related (thanks Emmanuel Cordonnier)
- soap_fault: fix serialization of detail
- soap_server: check required parameters for register method
- soap_server: when getallheaders is used, massage header names
- soap_server: use SOAPAction to determine operation when doc/lit service does not wrap parameters in an element with the method name (thanks Peter Hrastnik)
- soap_transport_http: correctly handle multiple HTTP/1.1 100 responses for https (thanks Jan Slabon)
- wsdl: fixed documentation for addComplexType (thanks Csintalan <20>d<EFBFBD>m)
- wsdl: serialize array data when maxOccurs = 'unbounded' OR maxOccurs > 1 (thanks Dominique Schreckling)
- wsdl: when serializing a string == 'false' as a boolean, set the value to false
- wsdl: when serializing a complexType, require the PHP value supplied to be an array
2005-07-01, version 0.7.1
- nusoap_base: Allow SOAP headers to be supplied as an array like parameters
- soap_parser: de-serialize simpleContent that accompanies complexContent
- soap_server: append debug information when programmatically-defined WSDL is returned
- soap_transport_http: Add debug when an outgoing header is set
- soapclient: Allow SOAP headers to be supplied as an array like parameters
- xmlschema: serialize attributes more generally, rather than assuming they are for SOAP 1.1 Array
- wsdl: when serializing, look up types by namespace, not prefix (simple programmatic doc/lit WSDL now seems to work)
- wsdl: process namespace declarations first when parsing an element
2005-07-27, version 0.7.1
- nusoap_base: do not override supplied element name with class name when serializing an object in serialize_val
- nusoap_base: remove http://soapinterop.org/xsd (si) from namespaces array
- nusoapmime: add nusoapservermime class to implement MIME attachments on the server
- soap_fault: improve documentation
- soap_server: improve documentation
- soap_server: make consistent use of _SERVER and HTTP_SERVER_VARS
- soap_server: make all incoming HTTP header keys lower case
- soap_server: add hook functions to support subclassing for MIME attachments
- soap_transport_http: remove an unnecessary global statement
- soapclient: when creating a proxy, make $params within each function an associative array
- soapval: improve documentation
- wsdl: when serializing complexType elements, used typed serialization if there is either a type or a reference for the element
- wsdl: allow PHP objects to be serialized as SOAP structs in serializeType
- wsdl: for WSDL and XML Schema imports, don't forget to use the TCP port number (thanks Luca GIOPPO)
- wsdl: make consistent use of _SERVER and HTTP_SERVER_VARS
- xmlschema: improve documentation
2005-07-31, version 0.7.2
- nusoap_base: correctly serialize attributes in serialize_val (thanks Hidran Arias)
- soap_parser: when resolving references, do not assume that buildVal returns an array (thanks Akshell)
- soap_parser: removed decode_entities, which does not work (thanks Martin Sarsale)
- soap_server: fix a bug parsing headers from _SERVER and HTTP_SERVER_VARS (thanks Bert Catsburg)
- soap_server: parse all "headers" from HTTP_SERVER_VARS (not just HTTP_*)
- soap_server: use PHP_SELF instead of SCRIPT_NAME for WSDL endpoint
- soap_server: when generating a fault while debug_flag is true, put debug into faultdetail
- wsdl: add enumeration parameter to addSimpleType
- xmlschema: add enumeration parameter to addSimpleType
2003-07-21, version 0.6.5
- soap_transport_http: SOAPAction header is quoted again, fixes problem w/ Weblogic Server
- applied Jason Levitt patch for proper array serialization, fixes problem w/ Amazon shopping cart services
- fixed null value serialization
- applied patch from "BZC ToOn'S" - fixes wsdl serialization when no parameters
- applied John's patch, implementing compression for the server
2003-07-22, version 0.6.5
- soap_server: fixed bug causing charset encoding not to be passed to the parser
- soap_fault: added default encoding to the fault serialization
- soap_parser: changed the parser to pre-load the parent's result array when processing scalar values. This increases parsing speed.
2003-07-23, version 0.6.5
- soap_base: fix code that overwrites user-supplied attributes in serialize_val
- soap_base: use arrays-of-arrays rather than attempting multi-dimensional in serialize_val
- xmlschema: emit import statements and qualify all elements with prefix in serializeSchema (better interop with validation tools)
- soapclient: get xml character encoding from HTTP Content-Type header if provided, e.g. text/xml;charset="UTF-8"
- soapclient: use headers in call if provided (previously ignored this parameter)
- soap_server: in parse_request, if neither getallheaders nor $_SERVER are available, use $HTTP_SERVER_VARS to get SOAPAction and xml encoding
2003-07-24, version 0.6.5
- soap_transport_http: apply patch from Steven Brown "if the server closes connection prematurely, nusoap would spin trying to read data that isn't there"
2003-07-25, version 0.6.5
- wsdl: apply patch from Sven to workaround single schema limitation
- wsdl: apply a variant of the patch from Holger to handle empty values for array by serializing an array with 0 elements
- xmlschema: remove the redundant default namespace attribute on the schema element; everything in xsd is explicitly specified as being from xsd
- soap_transport_http: fix setCredentials and add TODO comments in sendHTTPS about what to change if this setCredentials stays
2003-07-30, version 0.6.5
- nusoap_base: change documentation of soap_defencoding to specify it is the encoding for outgoing messages
- nusoap_base: only change &, <, > to entities, not all HTML entities
- soap_transport_http: update the Content-Type header in sendRequest, since soap_defencoding could be changed after ctor is called
- soap_server: use soap_defencoding instead of charset_encoding
- soap_server: read encoding from _SERVER if available
- nusoap_base: do entity translation for string parameters with an xsd type specified (thanks David Derr)
2003-07-31, version 0.6.5
- soap_transport_http: add proxy authentication
- soap_transport_http: build payload the same way for http and https
- wsdl: add proxy authentication
- soapclient: add proxy authentication
- soapclient: allow proxy information in ctor, so that it can be used for wsdl
2003-08-01, version 0.6.5
- soap_transport_http: close a persistent connection that's at EOF
- soap_transport_http: prevent conflicts between setEncoding and usePersistentConnection
- soap_transport_http: fix use of $headers instead of $this->incoming_headers in getResponse
- soapclient: improve handling of persistent connections
- soapclient: force xml_encoding to upper case
- soap_server: let the Web server decide whether to close the connection (no Connection: close header)
- soap_server: force xml_encoding to upper case
2003-08-04, version 0.6.5
- soap_parser: use XML type information to pick a PHP data type; also decode base64
- soap_server: read all HTTP headers when using _SERVER or HTTP_SERVER_VARS
- soap_server: add gzip encoding support for outgoing messages
- soap_transport_http: deflate is gzcompress/gzuncompress (cf. http://archive.develooper.com/libwww@perl.org/msg04650.html)
- soap_transport_http: clean use of persistentConnection so it's always a set boolean
- soapclient: add responseData member to access deflated/gunzipped payload
2003-08-05, version 0.6.5
- soap_server: look multiple places when setting debug_flag
2003-08-07, version 0.6.5
- nusoap_base: serialize specified type (e.g. ArrayOfString) even for simple array
- wsdl: only specify encodingStyle in the input/output soap bindings when it is not empty (thanks Guillaume)
2003-08-15, version 0.6.5
- soap_parser: fix parsing of elements with no XSD type specified
- soap_parser: use PHP string type for XSD long and unsignedLong types
2003-08-16, version 0.6.5
- soap_parser: fix code generating warning (thanks Torsten)
2003-08-19, version 0.6.5
- soap_parser: fix another line of code generating a warning (thanks Torsten)
2003-08-22, version 0.6.5
- soap_server: remove all '--' from debug_str; previous code changed '---' to '- --'
- wsdl, soapclient, soap_parser: patch submitted by Mark Spavin as described by
the following...
> Changes for the multiple/nested imports from the wsdl file. This builds an
> array of files not just the last one and also checks for relative paths to
> the parent. This will then get the imported files from the remote site
> instead of your local disk. Local wsdl files should still work (untested).
>
> Changes for multiple encoding sytles as previously posted
2003-08-24, version 0.6.5
- wsdl, soapclient: fix some PHP notices from previous update
2003-08-26, version 0.6.5
- wsdl: support multiple SOAP ports
- soapclient, soap_server: when no charset is specified, use UTF-8, even though HTTP specifies US-ASCII.
- soap_transport_http: do not prepend $host with 'ssl://' for https (is this required for older cURL versions?)
2003-08-27, version 0.6.5
- soap_server: support compressed request messages (thanks John Huong)
- soap_parser: deserialize Apache Vector as an array
- xmlschema: use $this->typemap in getPHPType (which is not used)
- soapclient, wsdl: check for WSDL errors after serializing parameters
- nusoap_base: add serialization of Apache Map (when not using WSDL)
- wsdl: add serialization of Apache Map (when using WSDL)
- wsdl: only change &, <, > to entities, not all HTML entities
2003-08-28, version 0.6.5
- soap_transport_http: disable cURL verification of peer and server (formerly the cURL default)
- soap_transport_http: mingle cURL code with straight http, so sendHTTP is no longer needed
2003-08-29, version 0.6.6
- soap_transport_http: add setContentType
- soapclient: call setContentType using new getHTTPContentType and getHTTPContentTypeCharset
2003-09-05, version 0.6.6
- wsdl: add some more code to handle null/nil values (but there's still a way to go)
2003-10-21, version 0.6.6
- soap_transport_http: only include port in Host header if it was specified in the URL
- soap_transport_http: add some code to use OpenSSL for PHP ssl:// scheme, but comment out since it's not ready
- soap_server: use $_SERVER['PHP_SELF'] if $GLOBALS['PHP_SELF'] is not set
- wsdl: add WSDL request and response and transport debug to debug
- wsdl: handle custom type extending xmlschema namespace (GLUE ... Thanks Matt)
- soap_parser: add param to docs
- soapclient: add getHTTPBody, getHTTPContentType, getHTTPContentTypeCharset (anticipating MIME subclass)
2003-10-28, version 0.6.6
- nusoap_base: add expandEntities method
- wsdl: use expandEntities
- soap_fault: use expandEntities
- soap_transport_http: Allow credentials to be included in URL, rather than requiring setCredentials
- soap_transport_http: Merge HTTP headers that span multiple lines
- soap_parser: Properly set errors in ctor
- soapclient: Pass headers to parseResponse and parse them in that method
2003-10-30, version 0.6.6
- xmlschema: Add some information for the related type to an element
2003-12-09, version 0.6.6
- nusoap_base: Add some namespace methods previously in xmlschema
- xmlschema: Improve parsing of complexType, element and simpleType
- xmlschema: Improve serialization
- xmlschema: Track imports
- xmlschema: Track elementFormDefault and form attributes
- wsdl: Support multiple <schema> (note that setting $server->wsdl->schemaTargetNamespace no longer does anything! Use configureWSDL instead.)
- wsdl: Use form attribute of element to control namespace specification
- wsdl: Support chained imports (A imports B which imports C)
- wsdl: Include port in endpoint address when serializing
- soap_server: Fix use of style (rpc|document) and use (encoded|literal)
- soap_server: Support _SERVER[CONTENT_TYPE] in addition to _SERVER[HTTP_CONTENT_TYPE]
- soap_server: Support wsdl with multiple <schema>
- soap_client: Remove a var_dump
- soap_client: Add style and use parameters to call method to support doc/lit without WSDL
- soap_transport_http: Check that $this->fp exists when doing persistent connections
2003-12-17, version 0.6.6
- soap_server: pass namespaces to xmlschema constructor
- wsdl: post-process after all imports
- wsdl: remove some debug, add some error handling
- xmlschema: allow enclosing namespaces to be specified in constructor
- xmlschema: improve handling of compositors and simple types
2004-01-08, version 0.6.6
- soap_server: when requested WSDL is in a file, return to client using passthru (thanks Ingo Fischer)
- soapclient: have proxy inherit more client state
- soapclient: allow timeout and response timeout to be specified in the constructor
- wsdl: allow timeout and response timeout to be specified in the constructor
- soap_transport_http: allow response timeout to be specified in send and sendHTTPS
2004-01-28, version 0.6.6
- wsdl: add namespace for array and scalar when form is qualified
- wsdl: fix a bug in which data type of complexType elements were ignored in serialization
- wsdl: enhance handling of URLs with file scheme
- wsdl: add addSimpleType
- xmlschema: add addSimpleType
- xmlschema: always set phpType elements
- soapclient: allow a wsdl instance to be specified in constructor
- soap_server: allow a wsdl instance to be specified in constructor (not tested!)
- soap_server: fix default SOAPAction created in register method
- soap_transport_http: accept chunking with LF separators in addition to CRLF.
- wsdlcache: added class
- nusoapmime: fix comments
2004-02-23, version 0.6.6
- soap_transport_http: don't try to unchunk cURL data, since cURL already does it
- soap_transport_http: append CVS revision to version in User-Agent
- wsdl: serialize boolean as true|false, not 1|0, to agree with XML Schema
- soap_server: always exit() after returning WSDL
- soap_server: use the WSDL URL scheme as the default endpoint URL scheme
- soap_server: append CVS revision to version in X-SOAP-Server
- nusoap_base: add (CVS) revision
- wsdlcache: synchronize using a per-WSDL lock file (Thanks Ingo)
- wsdlcache: add cache lifetime, after which cache contents are invalidated (Thanks Ingo)
2004-03-15, version 0.6.6
- nusoap_base: add isArraySimpleOrStruct method
- soap_server: improve WSDL URL scheme determination
- soap_server: only deflate/gzip payloads > 1024 bytes
- soap_server: fix parameter order in fault method (always used as faultcode, faultstring)
- soap_server: refactor parse_request into multiple functions (for sanity)
- soap_server: set the namespace on the Response element to the same as the request
- soap_server: name the return value element 'return' by default
- soap_server: added and documented data fields, so that service programmers can use them if desired
- soap_parser: standardize parsing error message
- soap_parser: fix document and responseHeaders so they are the correct XML text (as documented)
- soap_transport_http: fix read from persistent connection
- soapclient: clean up debugging for persistent connection
- wsdl: enforce correct naming of messages parts when an associative array is used for parameters
- wsdl: better serialization of null values
- wsdl: standardize parsing error message
- xmlschema: standardize parsing error message
2004-03-24, version 0.6.7
- soap_transport_http: add digest authentication (based on code by Kevin A. Miller)
- xmlschema: improve parsing of import elements
- wsdl: do schema imports even if there are no wsdl imports
2004-04-12, version 0.6.7
- wsdl: serialize multiple elements when maxOccurs="unbounded" and value is an array
- wsdl: serialize soapval values (used to force an XML type, e.g. when WSDL uses an abstract type)
- nusoapmime: do not require nusoap.php (it is now the programmer's responsibility)
2004-04-21, version 0.6.7
- soap_parser: parse repeated element name into an array (de-serializes doc/lit array into a PHP array when there is more than 1 array element)
- soap_server: do not wrap response in a response element for a document style service
2004-04-30, version 0.6.7
- soap_transport_http: allow digest auth params to be separated by "," as well as ", "
- soap_transport_http: re-initialize incoming headers for each response
- soap_server: add methodreturnisliteralxml property to allow service function to return XML as a string
- soapclient: improve rpc/literal support
- soapclient: allow XML string as call params in addition to array
- soapclient: support document style and literal encoding when not using WSDL
2004-05-05, version 0.6.7
- wsdl: serialize PHP objects for WSDL XML Schema complexTypes, in addition to associative arrays
- wsdl: fix WSDL generation when there is no encodingStyle
- soap_transport_http: suppress fsockopen warnings
- soap_transport_http: detect socket timeouts when reading (0 bytes returned)
- soap_transport_http: read chunked content "in-line" so it works on a persistent connection
- nusoap_base: serialize boolean as true|false, not 1|0, to agree with XML Schema
- nusoap_base: serialize array of struct differently than array of array
2004-06-25, version 0.6.8
- soap_server: prefer gzip to deflate, since IE does not like our deflate
- soap_server: move webDescription to the wsdl class
- soap_server: allow class and instance method calls for service (thanks Ingo Fischer and Roland Knall)
- wsdl: get webDescription from the soap_server class
- wsdl: allow compression from the server
- wsdl: fix serialization of soapval without a type
- wsdl: propagate debug value from query string to SOAP endpoint in programmatic WSDL generation
- nusoap_base: add anyType, anySimpleType for 2001 XML Schema
- nusoap_base: provide additional debug functions
- soap_transport_http: ignore Content-Length when chunked encoding is used
- soap_transport_http: remove ':' from username for Basic authentication (cf. RFC 2617)
- soap_transport_http: urldecode username and password taken from URL
- soap_transport_http: use raw inflate/deflate for IE/IIS compatibility, rather than having Zlib headers according to HTTP 1.1 spec
- soap_transport_http: attempt to handle the case when both the service application and Web server compress the response
- soapclient: when creating proxy methods, replace '.' in operation name with '__' in function name
- soapclient: initialize requestHeaders in proxy
- general: use new debug methods; never access debug_str directly
2004-09-30, version 0.6.8
- soapclient: do not allow getProxy call when WSDL is not used
- soapclient: use ISO-8859-1 as the charset if not specified in the Content-Type header
- soapclient: when an empty string is specified for the call namespace, do not put the method element in a namespace
- soapclient: let soap_transport_http check for SSL support
- soapclient: have proxy inherit soap_defencoding from the client from which it is generated
- soapclient: do not assume that 'ns1' is an unused namespace prefix; always generate namespace prefixes randomly
- soap_parser: compare any encoding in the XML declaration to the charset from the HTTP Content-Type header (thanks Ingo Fischer)
- soap_parser: improve parse repeated element name into an array (de-serializes doc/lit array into a PHP array when there is more than 1 array element)
- soap_server: use ISO-8859-1 as the charset if not specified in the Content-Type header
- soap_server: allow suppression of automatic UTF-8 decoding
- soap_server: fix a bug when call_user_func_array() is used
- soap_transport_http: correct digest authentication through a proxy
- wsdl: serialize SOAP-ENC types similarly to XSD types
- xmlschema: force unprefixed type into default namespace
- xmlschema: fix serialization of definition of simple types
2004-10-01, version 0.6.8
- soap_parser: handle default namespace attributes
- soap_server: add default_utf8 field
- soap_server: support literal encoding (with RPC style)
- soap_transport_http: parse HTTP status and generate error for 300, 302-307, 400, 401-417, 501-505 (thanks for the idea Ghislain)
- soap_transport_http: follow HTTP redirection (HTTP status 301 and Location header) (thanks for the idea Ghislain)
- xmlschema: allow any attributes to be specified in an element of a complexType, e.g., abstract, default, form, minOccurs, maxOccurs, nillable (thanks Jirka Pech for the original patch)
2004-10-02, version 0.6.8
- soapclient: read/write cookies (thanks Ingo)
- soap_server: change faultcode on non-resendable faults to Client
- soap_transport_http: read/write cookies (thanks Ingo)
2004-10-05, version 0.6.8
- wsdl: add addElement method
- wsdl: support the document style in the register method
- xmlschema: parse unnamed simpleTypes, rather than ignoring them
- xmlschema: include untyped elements when parsing a complexType
- xmlschema: add addElement method
2004-10-14, version 0.6.8
- soapclient: support client certificates
- soap_parser: deserialize attributes, prefixing names with "!"
- soap_server: notify the client with HTML when WSDL is requested but not supported by service
- soap_transport_http: support client certificates
- wsdl: support defaults for elements of a complexType
- wsdl: serialize elements from complexType extension base
- wsdl: serialize data (associative array elements) as attributes according to XML Schema
- xmlschema: record extension base if present for a complexType
2004-12-15, version 0.6.8
- nusoap_base: add 2000 XML Schema (rare, but used by Akamai)
- soap_parser: avoid deserializing more common attributes that are not data
- soap_parser: be lax when HTTP specifies ISO-8859-1 (the default) and XML specifies UTF-8 (the norm)
- soap_server: account for the fact that get_class_methods returns methods in all lower case (thanks Steve Haldane)
- soap_transport_http: parse digest info that includes '=' in the data (thanks Jinsuk Kim)
- wsdl: feably handle some cases for literal serialization of form="unqualified" elements
- wsdl: don't serialize the decimal portion of a PHP double when the XML type is long
- wsdl: fix serialization of attributes for complexType that is an extension
- wsdlcache: enhance diagnostics
- xmlschema: handle untyped elements
- xmlschema: handle WSDL for SOAP Array that uses the base attribute plus a sequence of element
2005-01-22, version 0.6.8
- wsdl: allow an element in one schema to have a type from another schema
2005-01-24, version 0.6.8
- xmlschema: correctly parse nested complexType definitions
2005-02-14, version 0.6.8
- nusoap_base: fix a bug in which attributes were sometimes not serialized with a value
- nusoap_base: improve serialization of null values (thanks Dominique Stender)
- soap_parser: parse null values by handling the nil attribute (thanks Dominique Stender)
- soap_server: set character encoding for a fault to be the same as for the server (thanks Mark Scott)
- soap_server: correctly check for null value returned from method when WSDL is used (without WSDL, cannot distinguish whether NULL or void return is desired)
- soapclient: for document style, call should always return an array rooted at the response part (all bets are off when there are multiple parts)
- xmlschema: save enumeration values parsed from WSDL
2005-02-10, version 0.6.9
- soapclient: only set SOAP headers when they are specified in call params (so setHeaders still works)
2005-04-04, version 0.6.9
- soap_server: use get_class instead of is_a (thanks Thomas Noel)
- soapclient: use get_class instead of is_a (thanks Thomas Noel)
- soapclient: add setEndpoint method
- soap_transport_http: fix client certificates (thanks Doug Anarino and Eryan Eriobowo)
2005-04-29, version 0.6.9
- nusoap_base: add global variable and methods for setting debug level
- nusoap_base: use xsd:anyType instead of xsd:ur-type to serialize arrays with multiple element types (thanks Ingo Fischer)
- nusoap_base: expand entities in attributes (thanks Gaetano Giunta)
- soapclient: call parent constructor
- soapval: call parent constructor
- soap_fault: call parent constructor
- soap_parser: call parent constructor
- soap_server: assume get_class_methods always returns lower case for PHP 4.x only
- soap_server: call parent constructor
- soap_transport_http: do nothing in setEncoding if gzdeflate is not present (thanks Franck Touanen for pointing this out)
- soap_transport_http: fix check for server request for digest authentication (thanks Mark Spavin)
- soap_transport_http: call parent constructor
- wsdl: fix documentation page popup of one method after another (thanks Owen)
- wsdl: call parent constructor
- wsdl: expand entities in attributes (thanks Gaetano Giunta)
- xmlschema: call parent constructor
2005-06-03, version 0.6.9
- nusoap_base: serialize empty arrays as having elements xsd:anyType[0]
- nusoap_base: add encodingStyle parameter to serializeEnvelope
- nusoap_base: serialize xsi:type with nil values
- nusoap_base: improve debug and comments
- soap_parser: correctly parse an empty array to an empty array, not an empty string
- soap_parser: improve debug and comments
- soap_server: specify encodingStyle for envelope when WSDL is used
- soapclient: factor out new getProxyClassCode method
- soapclient: specify encodingStyle for envelope
- soapclient: improve debug and comments
- wsdl: add namespace for Apache SOAP types if a variable of such type is serialized
- wsdl: serialize nil value for nillable elements when no value is provided
- wsdl: serialize xsi:type with nil values
- wsdl: copy attributes as well as elements to an element from its complexType
- wsdl: specify encodingStyle for operations
- wsdl: improve debug and comments
- xmlschema: improve debug and comments
2005-06-03, version 0.7.0
- nusoap_base: improve debug and comments
- nusoap_base: fix version, which should have been 0.7.0 since 2005-03-04
2005-06-06, version 0.7.1
- nusoap_base: adjust numeric element names for serialization, instead of forcing them to 'soapVal'
- nusoapmime: add type=text/xml to multipart/related (thanks Emmanuel Cordonnier)
- soap_fault: fix serialization of detail
- soap_server: check required parameters for register method
- soap_server: when getallheaders is used, massage header names
- soap_server: use SOAPAction to determine operation when doc/lit service does not wrap parameters in an element with the method name (thanks Peter Hrastnik)
- soap_transport_http: correctly handle multiple HTTP/1.1 100 responses for https (thanks Jan Slabon)
- wsdl: fixed documentation for addComplexType (thanks Csintalan <20>d<EFBFBD>m)
- wsdl: serialize array data when maxOccurs = 'unbounded' OR maxOccurs > 1 (thanks Dominique Schreckling)
- wsdl: when serializing a string == 'false' as a boolean, set the value to false
- wsdl: when serializing a complexType, require the PHP value supplied to be an array
2005-07-01, version 0.7.1
- nusoap_base: Allow SOAP headers to be supplied as an array like parameters
- soap_parser: de-serialize simpleContent that accompanies complexContent
- soap_server: append debug information when programmatically-defined WSDL is returned
- soap_transport_http: Add debug when an outgoing header is set
- soapclient: Allow SOAP headers to be supplied as an array like parameters
- xmlschema: serialize attributes more generally, rather than assuming they are for SOAP 1.1 Array
- wsdl: when serializing, look up types by namespace, not prefix (simple programmatic doc/lit WSDL now seems to work)
- wsdl: process namespace declarations first when parsing an element
2005-07-27, version 0.7.1
- nusoap_base: do not override supplied element name with class name when serializing an object in serialize_val
- nusoap_base: remove http://soapinterop.org/xsd (si) from namespaces array
- nusoapmime: add nusoapservermime class to implement MIME attachments on the server
- soap_fault: improve documentation
- soap_server: improve documentation
- soap_server: make consistent use of _SERVER and HTTP_SERVER_VARS
- soap_server: make all incoming HTTP header keys lower case
- soap_server: add hook functions to support subclassing for MIME attachments
- soap_transport_http: remove an unnecessary global statement
- soapclient: when creating a proxy, make $params within each function an associative array
- soapval: improve documentation
- wsdl: when serializing complexType elements, used typed serialization if there is either a type or a reference for the element
- wsdl: allow PHP objects to be serialized as SOAP structs in serializeType
- wsdl: for WSDL and XML Schema imports, don't forget to use the TCP port number (thanks Luca GIOPPO)
- wsdl: make consistent use of _SERVER and HTTP_SERVER_VARS
- xmlschema: improve documentation
2005-07-31, version 0.7.2
- nusoap_base: correctly serialize attributes in serialize_val (thanks Hidran Arias)
- soap_parser: when resolving references, do not assume that buildVal returns an array (thanks Akshell)
- soap_parser: removed decode_entities, which does not work (thanks Martin Sarsale)
- soap_server: fix a bug parsing headers from _SERVER and HTTP_SERVER_VARS (thanks Bert Catsburg)
- soap_server: parse all "headers" from HTTP_SERVER_VARS (not just HTTP_*)
- soap_server: use PHP_SELF instead of SCRIPT_NAME for WSDL endpoint
- soap_server: when generating a fault while debug_flag is true, put debug into faultdetail
- wsdl: add enumeration parameter to addSimpleType
- xmlschema: add enumeration parameter to addSimpleType

File diff suppressed because it is too large Load Diff

View File

@@ -1,86 +1,86 @@
<?php
/**
* Contains information for a SOAP fault.
* Mainly used for returning faults from deployed functions
* in a server instance.
* @author Dietrich Ayala <dietrich@ganx4.com>
* @version $Id$
* @access public
*/
class soap_fault extends nusoap_base {
/**
* The fault code (client|server)
* @var string
* @access private
*/
var $faultcode;
/**
* The fault actor
* @var string
* @access private
*/
var $faultactor;
/**
* The fault string, a description of the fault
* @var string
* @access private
*/
var $faultstring;
/**
* The fault detail, typically a string or array of string
* @var mixed
* @access private
*/
var $faultdetail;
/**
* constructor
*
* @param string $faultcode (client | server)
* @param string $faultactor only used when msg routed between multiple actors
* @param string $faultstring human readable error message
* @param mixed $faultdetail detail, typically a string or array of string
*/
function soap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
parent::nusoap_base();
$this->faultcode = $faultcode;
$this->faultactor = $faultactor;
$this->faultstring = $faultstring;
$this->faultdetail = $faultdetail;
}
/**
* serialize a fault
*
* @return string The serialization of the fault instance.
* @access public
*/
function serialize(){
$ns_string = '';
foreach($this->namespaces as $k => $v){
$ns_string .= "\n xmlns:$k=\"$v\"";
}
$return_msg =
'<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?>'.
'<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string.">\n".
'<SOAP-ENV:Body>'.
'<SOAP-ENV:Fault>'.
$this->serialize_val($this->faultcode, 'faultcode').
$this->serialize_val($this->faultactor, 'faultactor').
$this->serialize_val($this->faultstring, 'faultstring').
$this->serialize_val($this->faultdetail, 'detail').
'</SOAP-ENV:Fault>'.
'</SOAP-ENV:Body>'.
'</SOAP-ENV:Envelope>';
return $return_msg;
}
}
<?php
/**
* Contains information for a SOAP fault.
* Mainly used for returning faults from deployed functions
* in a server instance.
* @author Dietrich Ayala <dietrich@ganx4.com>
* @version $Id$
* @access public
*/
class soap_fault extends nusoap_base {
/**
* The fault code (client|server)
* @var string
* @access private
*/
var $faultcode;
/**
* The fault actor
* @var string
* @access private
*/
var $faultactor;
/**
* The fault string, a description of the fault
* @var string
* @access private
*/
var $faultstring;
/**
* The fault detail, typically a string or array of string
* @var mixed
* @access private
*/
var $faultdetail;
/**
* constructor
*
* @param string $faultcode (client | server)
* @param string $faultactor only used when msg routed between multiple actors
* @param string $faultstring human readable error message
* @param mixed $faultdetail detail, typically a string or array of string
*/
function soap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
parent::nusoap_base();
$this->faultcode = $faultcode;
$this->faultactor = $faultactor;
$this->faultstring = $faultstring;
$this->faultdetail = $faultdetail;
}
/**
* serialize a fault
*
* @return string The serialization of the fault instance.
* @access public
*/
function serialize(){
$ns_string = '';
foreach($this->namespaces as $k => $v){
$ns_string .= "\n xmlns:$k=\"$v\"";
}
$return_msg =
'<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?>'.
'<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string.">\n".
'<SOAP-ENV:Body>'.
'<SOAP-ENV:Fault>'.
$this->serialize_val($this->faultcode, 'faultcode').
$this->serialize_val($this->faultactor, 'faultactor').
$this->serialize_val($this->faultstring, 'faultstring').
$this->serialize_val($this->faultdetail, 'detail').
'</SOAP-ENV:Fault>'.
'</SOAP-ENV:Body>'.
'</SOAP-ENV:Envelope>';
return $return_msg;
}
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,107 +1,107 @@
<?php
/**
* For creating serializable abstractions of native PHP types. This class
* allows element name/namespace, XSD type, and XML attributes to be
* associated with a value. This is extremely useful when WSDL is not
* used, but is also useful when WSDL is used with polymorphic types, including
* xsd:anyType and user-defined types.
*
* @author Dietrich Ayala <dietrich@ganx4.com>
* @version $Id$
* @access public
*/
class soapval extends nusoap_base {
/**
* The XML element name
*
* @var string
* @access private
*/
var $name;
/**
* The XML type name (string or false)
*
* @var mixed
* @access private
*/
var $type;
/**
* The PHP value
*
* @var mixed
* @access private
*/
var $value;
/**
* The XML element namespace (string or false)
*
* @var mixed
* @access private
*/
var $element_ns;
/**
* The XML type namespace (string or false)
*
* @var mixed
* @access private
*/
var $type_ns;
/**
* The XML element attributes (array or false)
*
* @var mixed
* @access private
*/
var $attributes;
/**
* constructor
*
* @param string $name optional name
* @param mixed $type optional type name
* @param mixed $value optional value
* @param mixed $element_ns optional namespace of value
* @param mixed $type_ns optional namespace of type
* @param mixed $attributes associative array of attributes to add to element serialization
* @access public
*/
function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
parent::nusoap_base();
$this->name = $name;
$this->type = $type;
$this->value = $value;
$this->element_ns = $element_ns;
$this->type_ns = $type_ns;
$this->attributes = $attributes;
}
/**
* return serialized value
*
* @param string $use The WSDL use value (encoded|literal)
* @return string XML data
* @access public
*/
function serialize($use='encoded') {
return $this->serialize_val($this->value,$this->name,$this->type,$this->element_ns,$this->type_ns,$this->attributes,$use);
}
/**
* decodes a soapval object into a PHP native type
*
* @return mixed
* @access public
*/
function decode(){
return $this->value;
}
}
<?php
/**
* For creating serializable abstractions of native PHP types. This class
* allows element name/namespace, XSD type, and XML attributes to be
* associated with a value. This is extremely useful when WSDL is not
* used, but is also useful when WSDL is used with polymorphic types, including
* xsd:anyType and user-defined types.
*
* @author Dietrich Ayala <dietrich@ganx4.com>
* @version $Id$
* @access public
*/
class soapval extends nusoap_base {
/**
* The XML element name
*
* @var string
* @access private
*/
var $name;
/**
* The XML type name (string or false)
*
* @var mixed
* @access private
*/
var $type;
/**
* The PHP value
*
* @var mixed
* @access private
*/
var $value;
/**
* The XML element namespace (string or false)
*
* @var mixed
* @access private
*/
var $element_ns;
/**
* The XML type namespace (string or false)
*
* @var mixed
* @access private
*/
var $type_ns;
/**
* The XML element attributes (array or false)
*
* @var mixed
* @access private
*/
var $attributes;
/**
* constructor
*
* @param string $name optional name
* @param mixed $type optional type name
* @param mixed $value optional value
* @param mixed $element_ns optional namespace of value
* @param mixed $type_ns optional namespace of type
* @param mixed $attributes associative array of attributes to add to element serialization
* @access public
*/
function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
parent::nusoap_base();
$this->name = $name;
$this->type = $type;
$this->value = $value;
$this->element_ns = $element_ns;
$this->type_ns = $type_ns;
$this->attributes = $attributes;
}
/**
* return serialized value
*
* @param string $use The WSDL use value (encoded|literal)
* @return string XML data
* @access public
*/
function serialize($use='encoded') {
return $this->serialize_val($this->value,$this->name,$this->type,$this->element_ns,$this->type_ns,$this->attributes,$use);
}
/**
* decodes a soapval object into a PHP native type
*
* @return mixed
* @access public
*/
function decode(){
return $this->value;
}
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,184 +1,184 @@
<?php
/**
* caches instances of the wsdl class
*
* @author Scott Nichol <snichol@computer.org>
* @author Ingo Fischer <ingo@apollon.de>
* @version $Id$
* @access public
*/
class wsdlcache {
/**
* @var resource
* @access private
*/
var $fplock;
/**
* @var integer
* @access private
*/
var $cache_lifetime;
/**
* @var string
* @access private
*/
var $cache_dir;
/**
* @var string
* @access public
*/
var $debug_str = '';
/**
* constructor
*
* @param string $cache_dir directory for cache-files
* @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited
* @access public
*/
function wsdlcache($cache_dir='.', $cache_lifetime=0) {
$this->fplock = array();
$this->cache_dir = $cache_dir != '' ? $cache_dir : '.';
$this->cache_lifetime = $cache_lifetime;
}
/**
* creates the filename used to cache a wsdl instance
*
* @param string $wsdl The URL of the wsdl instance
* @return string The filename used to cache the instance
* @access private
*/
function createFilename($wsdl) {
return $this->cache_dir.'/wsdlcache-' . md5($wsdl);
}
/**
* adds debug data to the class level debug string
*
* @param string $string debug data
* @access private
*/
function debug($string){
$this->debug_str .= get_class($this).": $string\n";
}
/**
* gets a wsdl instance from the cache
*
* @param string $wsdl The URL of the wsdl instance
* @return object wsdl The cached wsdl instance, null if the instance is not in the cache
* @access public
*/
function get($wsdl) {
$filename = $this->createFilename($wsdl);
if ($this->obtainMutex($filename, "r")) {
// check for expired WSDL that must be removed from the cache
if ($this->cache_lifetime > 0) {
if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) {
unlink($filename);
$this->debug("Expired $wsdl ($filename) from cache");
$this->releaseMutex($filename);
return null;
}
}
// see what there is to return
$fp = @fopen($filename, "r");
if ($fp) {
$s = implode("", @file($filename));
fclose($fp);
$this->debug("Got $wsdl ($filename) from cache");
} else {
$s = null;
$this->debug("$wsdl ($filename) not in cache");
}
$this->releaseMutex($filename);
return (!is_null($s)) ? unserialize($s) : null;
} else {
$this->debug("Unable to obtain mutex for $filename in get");
}
return null;
}
/**
* obtains the local mutex
*
* @param string $filename The Filename of the Cache to lock
* @param string $mode The open-mode ("r" or "w") or the file - affects lock-mode
* @return boolean Lock successfully obtained ?!
* @access private
*/
function obtainMutex($filename, $mode) {
if (isset($this->fplock[md5($filename)])) {
$this->debug("Lock for $filename already exists");
return false;
}
$this->fplock[md5($filename)] = fopen($filename.".lock", "w");
if ($mode == "r") {
return flock($this->fplock[md5($filename)], LOCK_SH);
} else {
return flock($this->fplock[md5($filename)], LOCK_EX);
}
}
/**
* adds a wsdl instance to the cache
*
* @param object wsdl $wsdl_instance The wsdl instance to add
* @return boolean WSDL successfully cached
* @access public
*/
function put($wsdl_instance) {
$filename = $this->createFilename($wsdl_instance->wsdl);
$s = serialize($wsdl_instance);
if ($this->obtainMutex($filename, "w")) {
$fp = fopen($filename, "w");
fputs($fp, $s);
fclose($fp);
$this->debug("Put $wsdl_instance->wsdl ($filename) in cache");
$this->releaseMutex($filename);
return true;
} else {
$this->debug("Unable to obtain mutex for $filename in put");
}
return false;
}
/**
* releases the local mutex
*
* @param string $filename The Filename of the Cache to lock
* @return boolean Lock successfully released
* @access private
*/
function releaseMutex($filename) {
$ret = flock($this->fplock[md5($filename)], LOCK_UN);
fclose($this->fplock[md5($filename)]);
unset($this->fplock[md5($filename)]);
if (! $ret) {
$this->debug("Not able to release lock for $filename");
}
return $ret;
}
/**
* removes a wsdl instance from the cache
*
* @param string $wsdl The URL of the wsdl instance
* @return boolean Whether there was an instance to remove
* @access public
*/
function remove($wsdl) {
$filename = $this->createFilename($wsdl);
// ignore errors obtaining mutex
$this->obtainMutex($filename, "w");
$ret = unlink($filename);
$this->debug("Removed ($ret) $wsdl ($filename) from cache");
$this->releaseMutex($filename);
return $ret;
}
}
?>
<?php
/**
* caches instances of the wsdl class
*
* @author Scott Nichol <snichol@computer.org>
* @author Ingo Fischer <ingo@apollon.de>
* @version $Id$
* @access public
*/
class wsdlcache {
/**
* @var resource
* @access private
*/
var $fplock;
/**
* @var integer
* @access private
*/
var $cache_lifetime;
/**
* @var string
* @access private
*/
var $cache_dir;
/**
* @var string
* @access public
*/
var $debug_str = '';
/**
* constructor
*
* @param string $cache_dir directory for cache-files
* @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited
* @access public
*/
function wsdlcache($cache_dir='.', $cache_lifetime=0) {
$this->fplock = array();
$this->cache_dir = $cache_dir != '' ? $cache_dir : '.';
$this->cache_lifetime = $cache_lifetime;
}
/**
* creates the filename used to cache a wsdl instance
*
* @param string $wsdl The URL of the wsdl instance
* @return string The filename used to cache the instance
* @access private
*/
function createFilename($wsdl) {
return $this->cache_dir.'/wsdlcache-' . md5($wsdl);
}
/**
* adds debug data to the class level debug string
*
* @param string $string debug data
* @access private
*/
function debug($string){
$this->debug_str .= get_class($this).": $string\n";
}
/**
* gets a wsdl instance from the cache
*
* @param string $wsdl The URL of the wsdl instance
* @return object wsdl The cached wsdl instance, null if the instance is not in the cache
* @access public
*/
function get($wsdl) {
$filename = $this->createFilename($wsdl);
if ($this->obtainMutex($filename, "r")) {
// check for expired WSDL that must be removed from the cache
if ($this->cache_lifetime > 0) {
if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) {
unlink($filename);
$this->debug("Expired $wsdl ($filename) from cache");
$this->releaseMutex($filename);
return null;
}
}
// see what there is to return
$fp = @fopen($filename, "r");
if ($fp) {
$s = implode("", @file($filename));
fclose($fp);
$this->debug("Got $wsdl ($filename) from cache");
} else {
$s = null;
$this->debug("$wsdl ($filename) not in cache");
}
$this->releaseMutex($filename);
return (!is_null($s)) ? unserialize($s) : null;
} else {
$this->debug("Unable to obtain mutex for $filename in get");
}
return null;
}
/**
* obtains the local mutex
*
* @param string $filename The Filename of the Cache to lock
* @param string $mode The open-mode ("r" or "w") or the file - affects lock-mode
* @return boolean Lock successfully obtained ?!
* @access private
*/
function obtainMutex($filename, $mode) {
if (isset($this->fplock[md5($filename)])) {
$this->debug("Lock for $filename already exists");
return false;
}
$this->fplock[md5($filename)] = fopen($filename.".lock", "w");
if ($mode == "r") {
return flock($this->fplock[md5($filename)], LOCK_SH);
} else {
return flock($this->fplock[md5($filename)], LOCK_EX);
}
}
/**
* adds a wsdl instance to the cache
*
* @param object wsdl $wsdl_instance The wsdl instance to add
* @return boolean WSDL successfully cached
* @access public
*/
function put($wsdl_instance) {
$filename = $this->createFilename($wsdl_instance->wsdl);
$s = serialize($wsdl_instance);
if ($this->obtainMutex($filename, "w")) {
$fp = fopen($filename, "w");
fputs($fp, $s);
fclose($fp);
$this->debug("Put $wsdl_instance->wsdl ($filename) in cache");
$this->releaseMutex($filename);
return true;
} else {
$this->debug("Unable to obtain mutex for $filename in put");
}
return false;
}
/**
* releases the local mutex
*
* @param string $filename The Filename of the Cache to lock
* @return boolean Lock successfully released
* @access private
*/
function releaseMutex($filename) {
$ret = flock($this->fplock[md5($filename)], LOCK_UN);
fclose($this->fplock[md5($filename)]);
unset($this->fplock[md5($filename)]);
if (! $ret) {
$this->debug("Not able to release lock for $filename");
}
return $ret;
}
/**
* removes a wsdl instance from the cache
*
* @param string $wsdl The URL of the wsdl instance
* @return boolean Whether there was an instance to remove
* @access public
*/
function remove($wsdl) {
$filename = $this->createFilename($wsdl);
// ignore errors obtaining mutex
$this->obtainMutex($filename, "w");
$ret = unlink($filename);
$this->debug("Removed ($ret) $wsdl ($filename) from cache");
$this->releaseMutex($filename);
return $ret;
}
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,478 +1,478 @@
<?php
/*
$Id$
NuSOAP - Web Services Toolkit for PHP
Copyright (c) 2002 NuSphere Corporation
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you have any questions or comments, please email:
Dietrich Ayala
dietrich@ganx4.com
http://dietrich.ganx4.com/nusoap
NuSphere Corporation
http://www.nusphere.com
*/
/*require_once('nusoap.php');*/
/* PEAR Mail_MIME library */
require_once('Mail/mimeDecode.php');
require_once('Mail/mimePart.php');
/**
* soapclientmime client supporting MIME attachments defined at
* http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.
*
* @author Scott Nichol <snichol@sourceforge.net>
* @author Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
* @version $Id$
* @access public
*/
class soapclientmime extends soapclient {
/**
* @var array Each array element in the return is an associative array with keys
* data, filename, contenttype, cid
* @access private
*/
var $requestAttachments = array();
/**
* @var array Each array element in the return is an associative array with keys
* data, filename, contenttype, cid
* @access private
*/
var $responseAttachments;
/**
* @var string
* @access private
*/
var $mimeContentType;
/**
* 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.
*
* @param string $data The data of the attachment
* @param string $filename The filename of the attachment (default is empty string)
* @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream)
* @param string $cid The content-id (cid) of the attachment (default is false)
* @return string The content-id (cid) of the attachment
* @access public
*/
function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
if (! $cid) {
$cid = md5(uniqid(time()));
}
$info['data'] = $data;
$info['filename'] = $filename;
$info['contenttype'] = $contenttype;
$info['cid'] = $cid;
$this->requestAttachments[] = $info;
return $cid;
}
/**
* clears the MIME attachments for the current request.
*
* @access public
*/
function clearAttachments() {
$this->requestAttachments = array();
}
/**
* 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.
*
* @return array The attachments.
* @access public
*/
function getAttachments() {
return $this->responseAttachments;
}
/**
* gets the HTTP body for the current request.
*
* @param string $soapmsg The SOAP payload
* @return string The HTTP body, which includes the SOAP payload
* @access private
*/
function getHTTPBody($soapmsg) {
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);
}
/**
* gets the HTTP content type for the current request.
*
* Note: getHTTPBody must be called before this.
*
* @return string the HTTP content type for the current request.
* @access private
*/
function getHTTPContentType() {
if (count($this->requestAttachments) > 0) {
return $this->mimeContentType;
}
return parent::getHTTPContentType();
}
/**
* gets the HTTP content type charset for the current request.
* returns false for non-text content types.
*
* Note: getHTTPBody must be called before this.
*
* @return string the HTTP content type charset for the current request.
* @access private
*/
function getHTTPContentTypeCharset() {
if (count($this->requestAttachments) > 0) {
return false;
}
return parent::getHTTPContentTypeCharset();
}
/**
* processes SOAP message returned from server
*
* @param array $headers The HTTP headers
* @param string $data unprocessed response data from server
* @return mixed value of the message, decoded into a PHP type
* @access private
*/
function parseResponse($headers, $data) {
$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);
}
}
/**
* 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 <snichol@sourceforge.net>
* @author Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
* @version $Id$
* @access public
*/
class nusoapservermime extends soap_server {
/**
* @var array Each array element in the return is an associative array with keys
* data, filename, contenttype, cid
* @access private
*/
var $requestAttachments = array();
/**
* @var array Each array element in the return is an associative array with keys
* data, filename, contenttype, cid
* @access private
*/
var $responseAttachments;
/**
* @var string
* @access private
*/
var $mimeContentType;
/**
* 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.
*
* @param string $data The data of the attachment
* @param string $filename The filename of the attachment (default is empty string)
* @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream)
* @param string $cid The content-id (cid) of the attachment (default is false)
* @return string The content-id (cid) of the attachment
* @access public
*/
function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
if (! $cid) {
$cid = md5(uniqid(time()));
}
$info['data'] = $data;
$info['filename'] = $filename;
$info['contenttype'] = $contenttype;
$info['cid'] = $cid;
$this->responseAttachments[] = $info;
return $cid;
}
/**
* clears the MIME attachments for the current response.
*
* @access public
*/
function clearAttachments() {
$this->responseAttachments = array();
}
/**
* 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.
*
* @return array The attachments.
* @access public
*/
function getAttachments() {
return $this->requestAttachments;
}
/**
* gets the HTTP body for the current response.
*
* @param string $soapmsg The SOAP payload
* @return string The HTTP body, which includes the SOAP payload
* @access private
*/
function getHTTPBody($soapmsg) {
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';
$params['charset'] = $this->soap_defencoding;
$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);
}
/**
* gets the HTTP content type for the current response.
*
* Note: getHTTPBody must be called before this.
*
* @return string the HTTP content type for the current response.
* @access private
*/
function getHTTPContentType() {
if (count($this->responseAttachments) > 0) {
return $this->mimeContentType;
}
return parent::getHTTPContentType();
}
/**
* gets the HTTP content type charset for the current response.
* returns false for non-text content types.
*
* Note: getHTTPBody must be called before this.
*
* @return string the HTTP content type charset for the current response.
* @access private
*/
function getHTTPContentTypeCharset() {
if (count($this->responseAttachments) > 0) {
return false;
}
return parent::getHTTPContentTypeCharset();
}
/**
* processes SOAP message received from client
*
* @param array $headers The HTTP headers
* @param string $data unprocessed request data from client
* @return mixed value of the message, decoded into a PHP type
* @access private
*/
function parseRequest($headers, $data) {
$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');
return parent::parseRequest($headers, $data);
}
}
?>
<?php
/*
$Id$
NuSOAP - Web Services Toolkit for PHP
Copyright (c) 2002 NuSphere Corporation
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you have any questions or comments, please email:
Dietrich Ayala
dietrich@ganx4.com
http://dietrich.ganx4.com/nusoap
NuSphere Corporation
http://www.nusphere.com
*/
/*require_once('nusoap.php');*/
/* PEAR Mail_MIME library */
require_once('Mail/mimeDecode.php');
require_once('Mail/mimePart.php');
/**
* soapclientmime client supporting MIME attachments defined at
* http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library.
*
* @author Scott Nichol <snichol@sourceforge.net>
* @author Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
* @version $Id$
* @access public
*/
class soapclientmime extends soapclient {
/**
* @var array Each array element in the return is an associative array with keys
* data, filename, contenttype, cid
* @access private
*/
var $requestAttachments = array();
/**
* @var array Each array element in the return is an associative array with keys
* data, filename, contenttype, cid
* @access private
*/
var $responseAttachments;
/**
* @var string
* @access private
*/
var $mimeContentType;
/**
* 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.
*
* @param string $data The data of the attachment
* @param string $filename The filename of the attachment (default is empty string)
* @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream)
* @param string $cid The content-id (cid) of the attachment (default is false)
* @return string The content-id (cid) of the attachment
* @access public
*/
function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
if (! $cid) {
$cid = md5(uniqid(time()));
}
$info['data'] = $data;
$info['filename'] = $filename;
$info['contenttype'] = $contenttype;
$info['cid'] = $cid;
$this->requestAttachments[] = $info;
return $cid;
}
/**
* clears the MIME attachments for the current request.
*
* @access public
*/
function clearAttachments() {
$this->requestAttachments = array();
}
/**
* 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.
*
* @return array The attachments.
* @access public
*/
function getAttachments() {
return $this->responseAttachments;
}
/**
* gets the HTTP body for the current request.
*
* @param string $soapmsg The SOAP payload
* @return string The HTTP body, which includes the SOAP payload
* @access private
*/
function getHTTPBody($soapmsg) {
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);
}
/**
* gets the HTTP content type for the current request.
*
* Note: getHTTPBody must be called before this.
*
* @return string the HTTP content type for the current request.
* @access private
*/
function getHTTPContentType() {
if (count($this->requestAttachments) > 0) {
return $this->mimeContentType;
}
return parent::getHTTPContentType();
}
/**
* gets the HTTP content type charset for the current request.
* returns false for non-text content types.
*
* Note: getHTTPBody must be called before this.
*
* @return string the HTTP content type charset for the current request.
* @access private
*/
function getHTTPContentTypeCharset() {
if (count($this->requestAttachments) > 0) {
return false;
}
return parent::getHTTPContentTypeCharset();
}
/**
* processes SOAP message returned from server
*
* @param array $headers The HTTP headers
* @param string $data unprocessed response data from server
* @return mixed value of the message, decoded into a PHP type
* @access private
*/
function parseResponse($headers, $data) {
$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);
}
}
/**
* 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 <snichol@sourceforge.net>
* @author Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list
* @version $Id$
* @access public
*/
class nusoapservermime extends soap_server {
/**
* @var array Each array element in the return is an associative array with keys
* data, filename, contenttype, cid
* @access private
*/
var $requestAttachments = array();
/**
* @var array Each array element in the return is an associative array with keys
* data, filename, contenttype, cid
* @access private
*/
var $responseAttachments;
/**
* @var string
* @access private
*/
var $mimeContentType;
/**
* 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.
*
* @param string $data The data of the attachment
* @param string $filename The filename of the attachment (default is empty string)
* @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream)
* @param string $cid The content-id (cid) of the attachment (default is false)
* @return string The content-id (cid) of the attachment
* @access public
*/
function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
if (! $cid) {
$cid = md5(uniqid(time()));
}
$info['data'] = $data;
$info['filename'] = $filename;
$info['contenttype'] = $contenttype;
$info['cid'] = $cid;
$this->responseAttachments[] = $info;
return $cid;
}
/**
* clears the MIME attachments for the current response.
*
* @access public
*/
function clearAttachments() {
$this->responseAttachments = array();
}
/**
* 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.
*
* @return array The attachments.
* @access public
*/
function getAttachments() {
return $this->requestAttachments;
}
/**
* gets the HTTP body for the current response.
*
* @param string $soapmsg The SOAP payload
* @return string The HTTP body, which includes the SOAP payload
* @access private
*/
function getHTTPBody($soapmsg) {
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';
$params['charset'] = $this->soap_defencoding;
$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);
}
/**
* gets the HTTP content type for the current response.
*
* Note: getHTTPBody must be called before this.
*
* @return string the HTTP content type for the current response.
* @access private
*/
function getHTTPContentType() {
if (count($this->responseAttachments) > 0) {
return $this->mimeContentType;
}
return parent::getHTTPContentType();
}
/**
* gets the HTTP content type charset for the current response.
* returns false for non-text content types.
*
* Note: getHTTPBody must be called before this.
*
* @return string the HTTP content type charset for the current response.
* @access private
*/
function getHTTPContentTypeCharset() {
if (count($this->responseAttachments) > 0) {
return false;
}
return parent::getHTTPContentTypeCharset();
}
/**
* processes SOAP message received from client
*
* @param array $headers The HTTP headers
* @param string $data unprocessed request data from client
* @return mixed value of the message, decoded into a PHP type
* @access private
*/
function parseRequest($headers, $data) {
$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');
return parent::parseRequest($headers, $data);
}
}
?>