parent
c8ba5a01c7
commit
9acd2a0814
@ -0,0 +1,648 @@ |
||||
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 Ádá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 |
||||
|
||||
2006-02-02, version 0.7.2 |
||||
- soapclient: initialize paramArrayStr to improve proxy generation |
||||
- soap_parser: handle PHP5 soapclient's incorrect transmission of WSDL-described SOAP encoded arrays. |
||||
- soap_server: don't assume _SERVER['HTTPS'] is set; try HTTP_SERVER_VARS['HTTPS'] if it is not |
||||
- soap_server: "flatten out" the parameter array to call_user_func_array (thanks André Mamitzsch) |
||||
- soap_server: make thrown exceptions conform to specs |
||||
- wsdl: use serialize_val to serialize an array when the XSD type is soapenc:Array (JBoss/Axis does this) |
||||
- wsdl: change formatting of serialized XML for the WSDL |
||||
- xmlschema: change formatting of namespaces when serializing XML for the schema |
||||
|
||||
2006-04-07, version 0.7.2 |
||||
- soap_server: if methodparams is not an array, call call_user_func_array with an empty array (thanks Eric Grossi) |
||||
- wsdl: distinguish parts with element specified from those with type specified by suffixing element names with ^ |
||||
- wsdl: do a case-insensitive match on schema URI when looking for type |
||||
- xmlschema: only get element (not type) when name has ^ suffix |
||||
|
||||
2006-05-16, version 0.7.2 |
||||
- soapclient: add getHeader to get parsed SOAP Header |
||||
- soap_parser: check status when receiving Header or Body element |
||||
- soap_parser: add soapheader |
||||
- soap_server: add requestHeader with parsed SOAP Header |
||||
|
||||
2006-06-15, version 0.7.2 |
||||
- wsdl: fix bug in addComplexType (thanks Maarten Meijer) |
||||
- soap_transport_http: change cURL message |
||||
|
||||
2007-03-19, version 0.7.2 |
||||
- soapclient: declare as nusoapclient, then also subclass soapclient if SOAP extension not loaded |
||||
- soapclientmime: declare as nusoapclientmime, then also subclass soapclientmime if SOAP extension not loaded |
||||
|
||||
2007-03-28, version 0.7.2 |
||||
- nusoap_base: fix serialization of a soapval when its value is a soapval |
||||
- soapval: fix serialization of a soapval when its value is a soapval |
||||
- soapval: add __toString (cf. http://article.gmane.org/gmane.comp.php.nusoap.general/2776) |
||||
- nusoapclient: use lazy retrieval of WSDL instead of always getting it in the constructor |
||||
- nusoapclient: fix getProxy that was broken in last revision |
||||
- wsdl: add ability to set authorization credentials and retrieve WSDL outside of constructor |
||||
|
||||
2007-04-05, version 0.7.2 |
||||
- nusoapclientmime: don't rely exclusively on Content-Disposition to distinguish the root part from attachment; also check Content-Type (thanks Ben Bosman) |
||||
- nusoapclientmime: obey RFC 2045 Section 5.1 (thanks Chris Butler) |
||||
- nusoapservermime: don't rely exclusively on Content-Disposition to distinguish the root part from attachment; also check Content-Type (thanks Ben Bosman) |
||||
- nusoapservermime: obey RFC 2045 Section 5.1 (thanks Chris Butler) |
||||
- nusoap_base: remove extra whitespace from some XML elements |
||||
- nusoap_base: allow SOAP headers to be specified as an associative array (thanks Unique) |
||||
- nusoap_base: implement __toString |
||||
- nusoap_base: improve doc accuracy and consistency (thanks Martin K?gler) |
||||
- iso8601_to_timestamp: avoid problem with negative hours after calculation, etc. (thanks Guntram Trebs) |
||||
- nusoapclient: support user-settable cURL options (thanks Ciprian Popovici) |
||||
- nusoapclient: call SOAP 1.2 binding operations if no SOAP 1.1 present (there is no reason to believe this will always work!) |
||||
- nusoapclient: improve doc accuracy and consistency (thanks Martin K?gler) |
||||
- soap_server: don't try to use eval to call function when any parameter is an object |
||||
- soap_server: don't print return value within debug string; returned objects would need __toString in PHP 5.2 |
||||
- soap_server: use URL scheme for WSDL access as the scheme in SOAPAction |
||||
- soap_server: strip port number from server name (some FastCGI implementations include port in server name) |
||||
- soap_transport_http: support user-settable cURL options (thanks Ciprian Popovici) |
||||
- soap_transport_http: use cURL for NTLM authentication |
||||
- soap_transport_http: make digest authentication work for GET as well as POST |
||||
- soap_transport_http: improve doc accuracy and consistency (thanks Martin K?gler) |
||||
- soapval: remove __toString |
||||
- wsdl: set operation style if necessary, but do not override one already provided (thanks Raffaele Capobianco) |
||||
- wsdl: check SOAP 1.2 binding operations if no SOAP 1.1 present |
||||
- wsdl: improve doc accuracy and consistency (thanks Martin K?gler) |
||||
- xmlschema: fix simpleType serialization |
||||
- xmlschema: improve doc accuracy and consistency (thanks Martin K?gler) |
||||
|
||||
2007-04-09, version 0.7.2 |
||||
- nusoapclient: set decode_utf8 when creating a proxy (thanks Dmitri Dmitrienko) |
||||
- nusoapclient: rename class to nusoap_client |
||||
- soap_fault: also provide a class named nusoap_fault |
||||
- soap_parser: also provide a class named nusoap_parser |
||||
- soap_server: also provide a class named nusoap_server |
||||
- soap_transport_http: skip HTTP responses 301 and 401 when using cURL |
||||
- soap_transport_http: don't force HTTP Connection header when using cURL |
||||
- soap_transport_http: don't set HTTP Host and Content-Length headers when using cURL |
||||
- soap_transport_http: support CURLOPT_SSLCERTPASSWD (thanks David Blanco) |
||||
- wsdl: support user-settable cURL options (thanks Ciprian Popovici) |
||||
- wsdl: serialize parameters for non-SOAP 1.1 binding operations (there is no reason to believe this will always work!) |
||||
- xmlschema: also provide a class named nusoap_xmlschema |
||||
- nusoapclientmime: rename class to nusoap_client_mime |
||||
- nusoapservermime: rename class to nusoap_server_mime |
||||
|
||||
2007-04-11, version 0.7.2 |
||||
- nusoap_client: enable cURL usage to be forced (thanks Giunta Gaetano) |
||||
- soap_transport_http: enable cURL proxy usage (thanks Giunta Gaetano) |
||||
- soap_transport_http: enable cURL usage to be forced (thanks Giunta Gaetano) |
||||
- soap_transport_http: use cURL's HTTP authentication options for basic, digest |
||||
- wsdl: enable cURL usage to be forced (thanks Giunta Gaetano) |
||||
|
||||
2007-04-12, version 0.7.2 |
||||
- nusoap_client: add debug |
||||
- nusoap_xmlschema: don't add elements of complexTypes to elements array (thanks Heiko Hund) |
||||
- soap_transport_http: set cURL connection timeout if supported |
||||
- soap_transport_http: add debug when setting cURL option |
||||
- soap_transport_http: fix digest authentication broken in previous revision |
||||
- wsdl: add debug |
||||
- wsdlcache: address some issues with non-existing cache-files and PHP Warnings which came in such cases (thanks Ingo Fischer) |
||||
- wsdlcache: change class name to nusoap_wsdlcache |
||||
|
||||
2007-04-13, version 0.7.2 |
||||
- wsdl: wrap parameters if unwrapped values are supplied and WSDL specifies Microsoft-style wrapping |
||||
|
||||
2007-04-16, version 0.7.2 |
||||
- nusoap_base: avoid warning in getDebugAsXMLComment |
||||
- nusoap_client: small debug change |
||||
- nusoap_client_mime: set responseData when the root part is found |
||||
|
||||
2007-04-17, version 0.7.2 |
||||
- soap_transport_http: improve detection of undefined cURL options (thanks Ingo Fischer) |
||||
|
||||
2007-05-28, version 0.7.2 |
||||
- soap_transport_http: support digest authentication opaque feature (cf. RFC 2617) (thanks Daniel Lacroix) |
||||
- soap_transport_http: check safe_mode and open_basedir before setting CURLOPT_FOLLOWLOCATION |
||||
- soap_transport_http: skip "HTTP/1.0 200 Connection established" header when cURL returns it (thanks Raimund Jacob) |
||||
- nusoap_client: improve handling when getProxy is called and WSDL is not being used |
||||
- nusoap_base: add comments about which specifications are used/implemented by NuSOAP |
||||
- nusoap_xmlschema: create names for unnamed types that are unique by scope within XML Schema |
||||
|
||||
2007-06-11, version 0.7.2 |
||||
- wsdl: wrap return value if unwrapped value is supplied and WSDL specifies Microsoft-style wrapping |
||||
|
||||
2007-06-22, version 0.7.2 |
||||
- nusoap_xmlschema: fix serialization of simpleType restriction (thanks Rizwan Tejpar) |
||||
|
||||
2007-07-30, version 0.7.2 |
||||
- nusoap_server: Per http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735, rpc/literal accessor elements should not be in a namespace (thanks Kostas Kalevras) |
||||
- nusoap_client: Per http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735, rpc/literal accessor elements should not be in a namespace (thanks Kostas Kalevras) |
||||
|
||||
2007-10-21, version 0.7.2 |
||||
- nusoap_server: Per http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735, rpc/literal accessor elements should not be in a namespace (thanks Kostas Kalevras) |
||||
- nusoap_client: Per http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735, rpc/literal accessor elements should not be in a namespace (thanks Kostas Kalevras) |
||||
|
||||
2007-10-26, version 0.7.2 |
||||
- nusoap_server: Fix munging of _SERVER variables that start with HTTP_ (thanks Thomas Wieczorek) |
||||
|
||||
2007-10-30, version 0.7.2 |
||||
- nusoap_xmlschema: Serialize values for elementFormDefault, attributeFormDefault |
||||
- wsdl: Improve consistency between doc/lit schema auto-wrapping and client's parsed schema |
||||
- nusoap_server: Correct bug that placed encodingType in Envelope for doc/lit |
||||
- nusoap_server: Specify elementFormDefault for schema within doc/lit wsdl |
||||
|
||||
2007-10-31, version 0.7.2 |
||||
- wsdl: Fix typo in parametersMatchWrapped (thanks Sam Stepanyan) |
||||
- soap_transport_http: Fix three typos in setProxy (thanks Sam Stepanyan) |
||||
- nusoap_xmlschema: Fix typo in serializeTypeDef (thanks Sam Stepanyan) |
||||
|
||||
2007-11-06, version 1.0rc1 |
||||
- wsdl: Improve handling of return values from doc/lit methods |
||||
- nusoap_server: Handle case when method is not in a namespace |
||||
|
||||
2007-11-27, version 1.0rc1 |
||||
- nusoap_server: always try to invoke service for a POST |
||||
- nusoap_server: only return Location: for WSDL at http://... |
||||
- nusoap_base: change some syntax associated with globalDebugLevel |
||||
|
||||
2008-01-08, version 1.0rc1 |
||||
- nusoap_server: fix a typo where = was used instead of == (thanks J. (Johan) Bosma) |
||||
|
||||
2008-01-10, version 1.0rc1 |
||||
- nusoap_client: handle case where request or response has no content-type header (thanks Ingo Fischer) |
||||
- nusoap_server: handle case where request or response has no content-type header (thanks Ingo Fischer) |
||||
- wsdl: change CSS for .title in webDescription (thanks Marcus Uy) |
||||
|
||||
2008-01-25, version 1.0rc1 |
||||
- nusoap_xmlschema: when an element is of a complexType that is an extension, copy extensionBase from the type |
||||
- nusoap_xmlschema: do not apply elementFormDefault to globally defined elements |
||||
|
||||
2008-02-11, version 1.0rc1 |
||||
- wsdl: internally set form of wrapped parameter elements to unqualified (so server handles correctly) |
||||
|
||||
2008-03-03, version 1.0.rc1 |
||||
- nusoap_xmlschema: fix extension when base type has no explicit prefix |
||||
- nusoap_xmlschema: support XML Schema include |
||||
- wsdl: improve support for sequence by serializing inherited attributes and elements first |
||||
|
||||
2008-03-04, version 1.0.rc1 |
||||
- wsdl: allow WSDL port name to be specified in getOperations |
||||
- nusoap_client: allow WSDL port name to be specified in ctor |
||||
|
||||
2008-03-06, version 1.0rc1 |
||||
- wsdl: fix some port name variable references |
||||
- nusoap_base: change comments regarding preferred mode of support |
||||
- wsdl2nusoap: initial revision |
||||
|
||||
2008-03-14, version 1.0rc1 |
||||
- nusoap_base: fix timezone offset in timestamp_to_iso8601 (thanks Mario Trojan) |
||||
|
||||
2008-03-27, version 1.0rc1 |
||||
- nusoap_server: fix bug setting encodingStyle in serialize_return (thanks Luca Gobbo) |
||||
|
||||
2008-05-15, version 1.0rc1 |
||||
- nusoap_parser: handle case where Header or Body tags are used within SOAP messages (thanks Sergey Zhuravlev) |
||||
|
||||
2008-08-26, version 1.0rc1 |
||||
- wsdl: serialize simpleContent for complexType |
||||
- wsdl: avoid serializing complexType elements with no value and minOccurs = 0 regardless of nillability |
||||
|
||||
2010-04-26, version 0.9.5 |
||||
- nusoap_xmlschema: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) |
||||
- wsdl: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) |
||||
- soap_transport_http: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) |
||||
- soap_transport_http: remove call to deprecated function set_magic_quotes_runtime |
||||
- nusoap_server: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) |
||||
- nusoap_server: check that value is an object before calling get_class (thanks Pier-Luc Duchaine) |
||||
- nusoap_parser: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) |
||||
- nusoap_client: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) |
||||
- nusoap_client: do not assign the return value of new by reference (it is deprecated) (thanks Pier-Luc Duchaine) |
||||
- nusoap_base: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) |
||||
- nusoapmime: do not assign the return value of new by reference (it is deprecated) |
@ -0,0 +1,996 @@ |
||||
<?php |
||||
|
||||
/* |
||||
$Id: class.nusoap_base.php,v 1.56 2010/04/26 20:15:08 snichol Exp $ |
||||
|
||||
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 |
||||
|
||||
The NuSOAP project home is: |
||||
http://sourceforge.net/projects/nusoap/ |
||||
|
||||
The primary support for NuSOAP is the Help forum on the project home page. |
||||
|
||||
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 |
||||
|
||||
*/ |
||||
|
||||
/* |
||||
* Some of the standards implmented in whole or part by NuSOAP: |
||||
* |
||||
* SOAP 1.1 (http://www.w3.org/TR/2000/NOTE-SOAP-20000508/) |
||||
* WSDL 1.1 (http://www.w3.org/TR/2001/NOTE-wsdl-20010315) |
||||
* SOAP Messages With Attachments (http://www.w3.org/TR/SOAP-attachments) |
||||
* XML 1.0 (http://www.w3.org/TR/2006/REC-xml-20060816/) |
||||
* Namespaces in XML 1.0 (http://www.w3.org/TR/2006/REC-xml-names-20060816/) |
||||
* XML Schema 1.0 (http://www.w3.org/TR/xmlschema-0/) |
||||
* RFC 2045 Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies |
||||
* RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1 |
||||
* RFC 2617 HTTP Authentication: Basic and Digest Access Authentication |
||||
*/ |
||||
|
||||
/* load classes |
||||
|
||||
// necessary classes |
||||
require_once('class.soapclient.php'); |
||||
require_once('class.soap_val.php'); |
||||
require_once('class.soap_parser.php'); |
||||
require_once('class.soap_fault.php'); |
||||
|
||||
// transport classes |
||||
require_once('class.soap_transport_http.php'); |
||||
|
||||
// optional add-on classes |
||||
require_once('class.xmlschema.php'); |
||||
require_once('class.wsdl.php'); |
||||
|
||||
// server class |
||||
require_once('class.soap_server.php');*/ |
||||
|
||||
// class variable emulation |
||||
// cf. http://www.webkreator.com/php/techniques/php-static-class-variables.html |
||||
$GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = 9; |
||||
|
||||
/** |
||||
* |
||||
* nusoap_base |
||||
* |
||||
* @author Dietrich Ayala <dietrich@ganx4.com> |
||||
* @author Scott Nichol <snichol@users.sourceforge.net> |
||||
* @version $Id: class.nusoap_base.php,v 1.56 2010/04/26 20:15:08 snichol Exp $ |
||||
* @access public |
||||
*/ |
||||
class nusoap_base { |
||||
/** |
||||
* Identification for HTTP headers. |
||||
* |
||||
* @var string |
||||
* @access private |
||||
*/ |
||||
var $title = 'NuSOAP'; |
||||
/** |
||||
* Version for HTTP headers. |
||||
* |
||||
* @var string |
||||
* @access private |
||||
*/ |
||||
var $version = '0.9.5'; |
||||
/** |
||||
* CVS revision for HTTP headers. |
||||
* |
||||
* @var string |
||||
* @access private |
||||
*/ |
||||
var $revision = '$Revision: 1.56 $'; |
||||
/** |
||||
* Current error string (manipulated by getError/setError) |
||||
* |
||||
* @var string |
||||
* @access private |
||||
*/ |
||||
var $error_str = ''; |
||||
/** |
||||
* Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment) |
||||
* |
||||
* @var string |
||||
* @access private |
||||
*/ |
||||
var $debug_str = ''; |
||||
/** |
||||
* toggles automatic encoding of special characters as entities |
||||
* (should always be true, I think) |
||||
* |
||||
* @var boolean |
||||
* @access private |
||||
*/ |
||||
var $charencoding = true; |
||||
/** |
||||
* the debug level for this instance |
||||
* |
||||
* @var integer |
||||
* @access private |
||||
*/ |
||||
var $debugLevel; |
||||
|
||||
/** |
||||
* set schema version |
||||
* |
||||
* @var string |
||||
* @access public |
||||
*/ |
||||
var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'; |
||||
|
||||
/** |
||||
* charset encoding for outgoing messages |
||||
* |
||||
* @var string |
||||
* @access public |
||||
*/ |
||||
var $soap_defencoding = 'ISO-8859-1'; |
||||
//var $soap_defencoding = 'UTF-8'; |
||||
|
||||
/** |
||||
* namespaces in an array of prefix => uri |
||||
* |
||||
* this is "seeded" by a set of constants, but it may be altered by code |
||||
* |
||||
* @var array |
||||
* @access public |
||||
*/ |
||||
var $namespaces = array( |
||||
'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/', |
||||
'xsd' => 'http://www.w3.org/2001/XMLSchema', |
||||
'xsi' => 'http://www.w3.org/2001/XMLSchema-instance', |
||||
'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/' |
||||
); |
||||
|
||||
/** |
||||
* namespaces used in the current context, e.g. during serialization |
||||
* |
||||
* @var array |
||||
* @access private |
||||
*/ |
||||
var $usedNamespaces = array(); |
||||
|
||||
/** |
||||
* XML Schema types in an array of uri => (array of xml type => php type) |
||||
* is this legacy yet? |
||||
* no, this is used by the nusoap_xmlschema class to verify type => namespace mappings. |
||||
* @var array |
||||
* @access public |
||||
*/ |
||||
var $typemap = array( |
||||
'http://www.w3.org/2001/XMLSchema' => array( |
||||
'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double', |
||||
'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'', |
||||
'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string', |
||||
// abstract "any" types |
||||
'anyType'=>'string','anySimpleType'=>'string', |
||||
// derived datatypes |
||||
'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'', |
||||
'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer', |
||||
'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer', |
||||
'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''), |
||||
'http://www.w3.org/2000/10/XMLSchema' => array( |
||||
'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', |
||||
'float'=>'double','dateTime'=>'string', |
||||
'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), |
||||
'http://www.w3.org/1999/XMLSchema' => array( |
||||
'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', |
||||
'float'=>'double','dateTime'=>'string', |
||||
'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), |
||||
'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'), |
||||
'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'), |
||||
'http://xml.apache.org/xml-soap' => array('Map') |
||||
); |
||||
|
||||
/** |
||||
* XML entities to convert |
||||
* |
||||
* @var array |
||||
* @access public |
||||
* @deprecated |
||||
* @see expandEntities |
||||
*/ |
||||
var $xmlEntities = array('quot' => '"','amp' => '&', |
||||
'lt' => '<','gt' => '>','apos' => "'"); |
||||
|
||||
/** |
||||
* constructor |
||||
* |
||||
* @access public |
||||
*/ |
||||
function nusoap_base() { |
||||
$this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; |
||||
} |
||||
|
||||
/** |
||||
* gets the global debug level, which applies to future instances |
||||
* |
||||
* @return integer Debug level 0-9, where 0 turns off |
||||
* @access public |
||||
*/ |
||||
function getGlobalDebugLevel() { |
||||
return $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; |
||||
} |
||||
|
||||
/** |
||||
* sets the global debug level, which applies to future instances |
||||
* |
||||
* @param int $level Debug level 0-9, where 0 turns off |
||||
* @access public |
||||
*/ |
||||
function setGlobalDebugLevel($level) { |
||||
$GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = $level; |
||||
} |
||||
|
||||
/** |
||||
* gets the debug level for this instance |
||||
* |
||||
* @return int Debug level 0-9, where 0 turns off |
||||
* @access public |
||||
*/ |
||||
function getDebugLevel() { |
||||
return $this->debugLevel; |
||||
} |
||||
|
||||
/** |
||||
* sets the debug level for this instance |
||||
* |
||||
* @param int $level Debug level 0-9, where 0 turns off |
||||
* @access public |
||||
*/ |
||||
function setDebugLevel($level) { |
||||
$this->debugLevel = $level; |
||||
} |
||||
|
||||
/** |
||||
* adds debug data to the instance debug string with formatting |
||||
* |
||||
* @param string $string debug data |
||||
* @access private |
||||
*/ |
||||
function debug($string){ |
||||
if ($this->debugLevel > 0) { |
||||
$this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* adds debug data to the instance debug string without formatting |
||||
* |
||||
* @param string $string debug data |
||||
* @access public |
||||
*/ |
||||
function appendDebug($string){ |
||||
if ($this->debugLevel > 0) { |
||||
// it would be nice to use a memory stream here to use |
||||
// memory more efficiently |
||||
$this->debug_str .= $string; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* clears the current debug data for this instance |
||||
* |
||||
* @access public |
||||
*/ |
||||
function clearDebug() { |
||||
// it would be nice to use a memory stream here to use |
||||
// memory more efficiently |
||||
$this->debug_str = ''; |
||||
} |
||||
|
||||
/** |
||||
* gets the current debug data for this instance |
||||
* |
||||
* @return debug data |
||||
* @access public |
||||
*/ |
||||
function &getDebug() { |
||||
// it would be nice to use a memory stream here to use |
||||
// memory more efficiently |
||||
return $this->debug_str; |
||||
} |
||||
|
||||
/** |
||||
* gets the current debug data for this instance as an XML comment |
||||
* this may change the contents of the debug data |
||||
* |
||||
* @return debug data as an XML comment |
||||
* @access public |
||||
*/ |
||||
function &getDebugAsXMLComment() { |
||||
// it would be nice to use a memory stream here to use |
||||
// memory more efficiently |
||||
while (strpos($this->debug_str, '--')) { |
||||
$this->debug_str = str_replace('--', '- -', $this->debug_str); |
||||
} |
||||
$ret = "<!--\n" . $this->debug_str . "\n-->"; |
||||
return $ret; |
||||
} |
||||
|
||||
/** |
||||
* expands entities, e.g. changes '<' to '<'. |
||||
* |
||||
* @param string $val The string in which to expand entities. |
||||
* @access private |
||||
*/ |
||||
function expandEntities($val) { |
||||
if ($this->charencoding) { |
||||
$val = str_replace('&', '&', $val); |
||||
$val = str_replace("'", ''', $val); |
||||
$val = str_replace('"', '"', $val); |
||||
$val = str_replace('<', '<', $val); |
||||
$val = str_replace('>', '>', $val); |
||||
} |
||||
return $val; |
||||
} |
||||
|
||||
/** |
||||
* returns error string if present |
||||
* |
||||
* @return mixed error string or false |
||||
* @access public |
||||
*/ |
||||
function getError(){ |
||||
if($this->error_str != ''){ |
||||
return $this->error_str; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* sets error string |
||||
* |
||||
* @return boolean $string error string |
||||
* @access private |
||||
*/ |
||||
function setError($str){ |
||||
$this->error_str = $str; |
||||
} |
||||
|
||||
/** |
||||
* detect if array is a simple array or a struct (associative array) |
||||
* |
||||
* @param mixed $val The PHP array |
||||
* @return string (arraySimple|arrayStruct) |
||||
* @access private |
||||
*/ |
||||
function isArraySimpleOrStruct($val) { |
||||
$keyList = array_keys($val); |
||||
foreach ($keyList as $keyListValue) { |
||||
if (!is_int($keyListValue)) { |
||||
return 'arrayStruct'; |
||||
} |
||||
} |
||||
return 'arraySimple'; |
||||
} |
||||
|
||||
/** |
||||
* serializes PHP values in accordance w/ section 5. Type information is |
||||
* not serialized if $use == 'literal'. |
||||
* |
||||
* @param mixed $val The value to serialize |
||||
* @param string $name The name (local part) of the XML element |
||||
* @param string $type The XML schema type (local part) for the element |
||||
* @param string $name_ns The namespace for the name of the XML element |
||||
* @param string $type_ns The namespace for the type of the element |
||||
* @param array $attributes The attributes to serialize as name=>value pairs |
||||
* @param string $use The WSDL "use" (encoded|literal) |
||||
* @param boolean $soapval Whether this is called from soapval. |
||||
* @return string The serialized element, possibly with child elements |
||||
* @access public |
||||
*/ |
||||
function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded',$soapval=false) { |
||||
$this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval"); |
||||
$this->appendDebug('value=' . $this->varDump($val)); |
||||
$this->appendDebug('attributes=' . $this->varDump($attributes)); |
||||
|
||||
if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) { |
||||
$this->debug("serialize_val: serialize soapval"); |
||||
$xml = $val->serialize($use); |
||||
$this->appendDebug($val->getDebug()); |
||||
$val->clearDebug(); |
||||
$this->debug("serialize_val of soapval returning $xml"); |
||||
return $xml; |
||||
} |
||||
// force valid name if necessary |
||||
if (is_numeric($name)) { |
||||
$name = '__numeric_' . $name; |
||||
} elseif (! $name) { |
||||
$name = 'noname'; |
||||
} |
||||
// if name has ns, add ns prefix to name |
||||
$xmlns = ''; |
||||
if($name_ns){ |
||||
$prefix = 'nu'.rand(1000,9999); |
||||
$name = $prefix.':'.$name; |
||||
$xmlns .= " xmlns:$prefix=\"$name_ns\""; |
||||
} |
||||
// if type is prefixed, create type prefix |
||||
if($type_ns != '' && $type_ns == $this->namespaces['xsd']){ |
||||
// need to fix this. shouldn't default to xsd if no ns specified |
||||
// w/o checking against typemap |
||||
$type_prefix = 'xsd'; |
||||
} elseif($type_ns){ |
||||
$type_prefix = 'ns'.rand(1000,9999); |
||||
$xmlns .= " xmlns:$type_prefix=\"$type_ns\""; |
||||
} |
||||
// serialize attributes if present |
||||
$atts = ''; |
||||
if($attributes){ |
||||
foreach($attributes as $k => $v){ |
||||
$atts .= " $k=\"".$this->expandEntities($v).'"'; |
||||
} |
||||
} |
||||
// serialize null value |
||||
if (is_null($val)) { |
||||
$this->debug("serialize_val: serialize null"); |
||||
if ($use == 'literal') { |
||||
// TODO: depends on minOccurs |
||||
$xml = "<$name$xmlns$atts/>"; |
||||
$this->debug("serialize_val returning $xml"); |
||||
return $xml; |
||||
} else { |
||||
if (isset($type) && isset($type_prefix)) { |
||||
$type_str = " xsi:type=\"$type_prefix:$type\""; |
||||
} else { |
||||
$type_str = ''; |
||||
} |
||||
$xml = "<$name$xmlns$type_str$atts xsi:nil=\"true\"/>"; |
||||
$this->debug("serialize_val returning $xml"); |
||||
return $xml; |
||||
} |
||||
} |
||||
// serialize if an xsd built-in primitive type |
||||
if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){ |
||||
$this->debug("serialize_val: serialize xsd built-in primitive type"); |
||||
if (is_bool($val)) { |
||||
if ($type == 'boolean') { |
||||
$val = $val ? 'true' : 'false'; |
||||
} elseif (! $val) { |
||||
$val = 0; |
||||
} |
||||
} else if (is_string($val)) { |
||||
$val = $this->expandEntities($val); |
||||
} |
||||
if ($use == 'literal') { |
||||
$xml = "<$name$xmlns$atts>$val</$name>"; |
||||
$this->debug("serialize_val returning $xml"); |
||||
return $xml; |
||||
} else { |
||||
$xml = "<$name$xmlns xsi:type=\"xsd:$type\"$atts>$val</$name>"; |
||||
$this->debug("serialize_val returning $xml"); |
||||
return $xml; |
||||
} |
||||
} |
||||
// detect type and serialize |
||||
$xml = ''; |
||||
switch(true) { |
||||
case (is_bool($val) || $type == 'boolean'): |
||||
$this->debug("serialize_val: serialize boolean"); |
||||
if ($type == 'boolean') { |
||||
$val = $val ? 'true' : 'false'; |
||||
} elseif (! $val) { |
||||
$val = 0; |
||||
} |
||||
if ($use == 'literal') { |
||||
$xml .= "<$name$xmlns$atts>$val</$name>"; |
||||
} else { |
||||
$xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val</$name>"; |
||||
} |
||||
break; |
||||
case (is_int($val) || is_long($val) || $type == 'int'): |
||||
$this->debug("serialize_val: serialize int"); |
||||
if ($use == 'literal') { |
||||
$xml .= "<$name$xmlns$atts>$val</$name>"; |
||||
} else { |
||||
$xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>"; |
||||
} |
||||
break; |
||||
case (is_float($val)|| is_double($val) || $type == 'float'): |
||||
$this->debug("serialize_val: serialize float"); |
||||
if ($use == 'literal') { |
||||
$xml .= "<$name$xmlns$atts>$val</$name>"; |
||||
} else { |
||||
$xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val</$name>"; |
||||
} |
||||
break; |
||||
case (is_string($val) || $type == 'string'): |
||||
$this->debug("serialize_val: serialize string"); |
||||
$val = $this->expandEntities($val); |
||||
if ($use == 'literal') { |
||||
$xml .= "<$name$xmlns$atts>$val</$name>"; |
||||
} else { |
||||
$xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>"; |
||||
} |
||||
break; |
||||
case is_object($val): |
||||
$this->debug("serialize_val: serialize object"); |
||||
if (get_class($val) == 'soapval') { |
||||
$this->debug("serialize_val: serialize soapval object"); |
||||
$pXml = $val->serialize($use); |
||||
$this->appendDebug($val->getDebug()); |
||||
$val->clearDebug(); |
||||
} else { |
||||
if (! $name) { |
||||
$name = get_class($val); |
||||
$this->debug("In serialize_val, used class name $name as element name"); |
||||
} else { |
||||
$this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val)); |
||||
} |
||||
foreach(get_object_vars($val) as $k => $v){ |
||||
$pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use); |
||||
} |
||||
} |
||||
if(isset($type) && isset($type_prefix)){ |
||||
$type_str = " xsi:type=\"$type_prefix:$type\""; |
||||
} else { |
||||
$type_str = ''; |
||||
} |
||||
if ($use == 'literal') { |
||||
$xml .= "<$name$xmlns$atts>$pXml</$name>"; |
||||
} else { |
||||
$xml .= "<$name$xmlns$type_str$atts>$pXml</$name>"; |
||||
} |
||||
break; |
||||
break; |
||||
case (is_array($val) || $type): |
||||
// detect if struct or array |
||||
$valueType = $this->isArraySimpleOrStruct($val); |
||||
if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){ |
||||
$this->debug("serialize_val: serialize array"); |
||||
$i = 0; |
||||
if(is_array($val) && count($val)> 0){ |
||||
foreach($val as $v){ |
||||
if(is_object($v) && get_class($v) == 'soapval'){ |
||||
$tt_ns = $v->type_ns; |
||||
$tt = $v->type; |
||||
} elseif (is_array($v)) { |
||||
$tt = $this->isArraySimpleOrStruct($v); |
||||
} else { |
||||
$tt = gettype($v); |
||||
} |
||||
$array_types[$tt] = 1; |
||||
// TODO: for literal, the name should be $name |
||||
$xml .= $this->serialize_val($v,'item',false,false,false,false,$use); |
||||
++$i; |
||||
} |
||||
if(count($array_types) > 1){ |
||||
$array_typename = 'xsd:anyType'; |
||||
} elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) { |
||||
if ($tt == 'integer') { |
||||
$tt = 'int'; |
||||
} |
||||
$array_typename = 'xsd:'.$tt; |
||||
} elseif(isset($tt) && $tt == 'arraySimple'){ |
||||
$array_typename = 'SOAP-ENC:Array'; |
||||
} elseif(isset($tt) && $tt == 'arrayStruct'){ |
||||
$array_typename = 'unnamed_struct_use_soapval'; |
||||
} else { |
||||
// if type is prefixed, create type prefix |
||||
if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){ |
||||
$array_typename = 'xsd:' . $tt; |
||||
} elseif ($tt_ns) { |
||||
$tt_prefix = 'ns' . rand(1000, 9999); |
||||
$array_typename = "$tt_prefix:$tt"; |
||||
$xmlns .= " xmlns:$tt_prefix=\"$tt_ns\""; |
||||
} else { |
||||
$array_typename = $tt; |
||||
} |
||||
} |
||||
$array_type = $i; |
||||
if ($use == 'literal') { |
||||
$type_str = ''; |
||||
} else if (isset($type) && isset($type_prefix)) { |
||||
$type_str = " xsi:type=\"$type_prefix:$type\""; |
||||
} else { |
||||
$type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\""; |
||||
} |
||||
// empty array |
||||
} else { |
||||
if ($use == 'literal') { |
||||
$type_str = ''; |
||||
} else if (isset($type) && isset($type_prefix)) { |
||||
$type_str = " xsi:type=\"$type_prefix:$type\""; |
||||
} else { |
||||
$type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\""; |
||||
} |
||||
} |
||||
// TODO: for array in literal, there is no wrapper here |
||||
$xml = "<$name$xmlns$type_str$atts>".$xml."</$name>"; |
||||
} else { |
||||
// got a struct |
||||
$this->debug("serialize_val: serialize struct"); |
||||
if(isset($type) && isset($type_prefix)){ |
||||
$type_str = " xsi:type=\"$type_prefix:$type\""; |
||||
} else { |
||||
$type_str = ''; |
||||
} |
||||
if ($use == 'literal') { |
||||
$xml .= "<$name$xmlns$atts>"; |
||||
} else { |
||||
$xml .= "<$name$xmlns$type_str$atts>"; |
||||
} |
||||
foreach($val as $k => $v){ |
||||
// Apache Map |
||||
if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') { |
||||
$xml .= '<item>'; |
||||
$xml .= $this->serialize_val($k,'key',false,false,false,false,$use); |
||||
$xml .= $this->serialize_val($v,'value',false,false,false,false,$use); |
||||
$xml .= '</item>'; |
||||
} else { |
||||
$xml .= $this->serialize_val($v,$k,false,false,false,false,$use); |
||||
} |
||||
} |
||||
$xml .= "</$name>"; |
||||
} |
||||
break; |
||||
default: |
||||
$this->debug("serialize_val: serialize unknown"); |
||||
$xml .= 'not detected, got '.gettype($val).' for '.$val; |
||||
break; |
||||
} |
||||
$this->debug("serialize_val returning $xml"); |
||||
return $xml; |
||||
} |
||||
|
||||
/** |
||||
* serializes a message |
||||
* |
||||
* @param string $body the XML of the SOAP body |
||||
* @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array |
||||
* @param array $namespaces optional the namespaces used in generating the body and headers |
||||
* @param string $style optional (rpc|document) |
||||
* @param string $use optional (encoded|literal) |
||||
* @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) |
||||
* @return string the message |
||||
* @access public |
||||
*/ |
||||
function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){ |
||||
// TODO: add an option to automatically run utf8_encode on $body and $headers |
||||
// if $this->soap_defencoding is UTF-8. Not doing this automatically allows |
||||
// one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1 |
||||
|
||||
$this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle"); |
||||
$this->debug("headers:"); |
||||
$this->appendDebug($this->varDump($headers)); |
||||
$this->debug("namespaces:"); |
||||
$this->appendDebug($this->varDump($namespaces)); |
||||
|
||||
// serialize namespaces |
||||
$ns_string = ''; |
||||
foreach(array_merge($this->namespaces,$namespaces) as $k => $v){ |
||||
$ns_string .= " xmlns:$k=\"$v\""; |
||||
} |
||||
if($encodingStyle) { |
||||
$ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string"; |
||||
} |
||||
|
||||
// serialize headers |
||||
if($headers){ |
||||
if (is_array($headers)) { |
||||
$xml = ''; |
||||
foreach ($headers as $k => $v) { |
||||
if (is_object($v) && get_class($v) == 'soapval') { |
||||
$xml .= $this->serialize_val($v, false, false, false, false, false, $use); |
||||
} else { |
||||
$xml .= $this->serialize_val($v, $k, false, false, false, false, $use); |
||||
} |
||||
} |
||||
$headers = $xml; |
||||
$this->debug("In serializeEnvelope, serialized array of headers to $headers"); |
||||
} |
||||
$headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>"; |
||||
} |
||||
// serialize envelope |
||||
return |
||||
'<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">". |
||||
'<SOAP-ENV:Envelope'.$ns_string.">". |
||||
$headers. |
||||
"<SOAP-ENV:Body>". |
||||
$body. |
||||
"</SOAP-ENV:Body>". |
||||
"</SOAP-ENV:Envelope>"; |
||||
} |
||||
|
||||
/** |
||||
* formats a string to be inserted into an HTML stream |
||||
* |
||||
* @param string $str The string to format |
||||
* @return string The formatted string |
||||
* @access public |
||||
* @deprecated |
||||
*/ |
||||
function formatDump($str){ |
||||
$str = htmlspecialchars($str); |
||||
return nl2br($str); |
||||
} |
||||
|
||||
/** |
||||
* contracts (changes namespace to prefix) a qualified name |
||||
* |
||||
* @param string $qname qname |
||||
* @return string contracted qname |
||||
* @access private |
||||
*/ |
||||
function contractQname($qname){ |
||||
// get element namespace |
||||
//$this->xdebug("Contract $qname"); |
||||
if (strrpos($qname, ':')) { |
||||
// get unqualified name |
||||
$name = substr($qname, strrpos($qname, ':') + 1); |
||||
// get ns |
||||
$ns = substr($qname, 0, strrpos($qname, ':')); |
||||
$p = $this->getPrefixFromNamespace($ns); |
||||
if ($p) { |
||||
return $p . ':' . $name; |
||||
} |
||||
return $qname; |
||||
} else { |
||||
return $qname; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* expands (changes prefix to namespace) a qualified name |
||||
* |
||||
* @param string $qname qname |
||||
* @return string expanded qname |
||||
* @access private |
||||
*/ |
||||
function expandQname($qname){ |
||||
// get element prefix |
||||
if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){ |
||||
// get unqualified name |
||||
$name = substr(strstr($qname,':'),1); |
||||
// get ns prefix |
||||
$prefix = substr($qname,0,strpos($qname,':')); |
||||
if(isset($this->namespaces[$prefix])){ |
||||
return $this->namespaces[$prefix].':'.$name; |
||||
} else { |
||||
return $qname; |
||||
} |
||||
} else { |
||||
return $qname; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* returns the local part of a prefixed string |
||||
* returns the original string, if not prefixed |
||||
* |
||||
* @param string $str The prefixed string |
||||
* @return string The local part |
||||
* @access public |
||||
*/ |
||||
function getLocalPart($str){ |
||||
if($sstr = strrchr($str,':')){ |
||||
// get unqualified name |
||||
return substr( $sstr, 1 ); |
||||
} else { |
||||
return $str; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* returns the prefix part of a prefixed string |
||||
* returns false, if not prefixed |
||||
* |
||||
* @param string $str The prefixed string |
||||
* @return mixed The prefix or false if there is no prefix |
||||
* @access public |
||||
*/ |
||||
function getPrefix($str){ |
||||
if($pos = strrpos($str,':')){ |
||||
// get prefix |
||||
return substr($str,0,$pos); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* pass it a prefix, it returns a namespace |
||||
* |
||||
* @param string $prefix The prefix |
||||
* @return mixed The namespace, false if no namespace has the specified prefix |
||||
* @access public |
||||
*/ |
||||
function getNamespaceFromPrefix($prefix){ |
||||
if (isset($this->namespaces[$prefix])) { |
||||
return $this->namespaces[$prefix]; |
||||
} |
||||
//$this->setError("No namespace registered for prefix '$prefix'"); |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* returns the prefix for a given namespace (or prefix) |
||||
* or false if no prefixes registered for the given namespace |
||||
* |
||||
* @param string $ns The namespace |
||||
* @return mixed The prefix, false if the namespace has no prefixes |
||||
* @access public |
||||
*/ |
||||
function getPrefixFromNamespace($ns) { |
||||
foreach ($this->namespaces as $p => $n) { |
||||
if ($ns == $n || $ns == $p) { |
||||
$this->usedNamespaces[$p] = $n; |
||||
return $p; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* returns the time in ODBC canonical form with microseconds |
||||
* |
||||
* @return string The time in ODBC canonical form with microseconds |
||||
* @access public |
||||
*/ |
||||
function getmicrotime() { |
||||
if (function_exists('gettimeofday')) { |
||||
$tod = gettimeofday(); |
||||
$sec = $tod['sec']; |
||||
$usec = $tod['usec']; |
||||
} else { |
||||
$sec = time(); |
||||
$usec = 0; |
||||
} |
||||
return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec); |
||||
} |
||||
|
||||
/** |
||||
* Returns a string with the output of var_dump |
||||
* |
||||
* @param mixed $data The variable to var_dump |
||||
* @return string The output of var_dump |
||||
* @access public |
||||
*/ |
||||
function varDump($data) { |
||||
ob_start(); |
||||
var_dump($data); |
||||
$ret_val = ob_get_contents(); |
||||
ob_end_clean(); |
||||
return $ret_val; |
||||
} |
||||
|
||||
/** |
||||
* represents the object as a string |
||||
* |
||||
* @return string |
||||
* @access public |
||||
*/ |
||||
function __toString() { |
||||
return $this->varDump($this); |
||||
} |
||||
} |
||||
|
||||
// XML Schema Datatype Helper Functions |
||||
|
||||
//xsd:dateTime helpers |
||||
|
||||
/** |
||||
* convert unix timestamp to ISO 8601 compliant date string |
||||
* |
||||
* @param int $timestamp Unix time stamp |
||||
* @param boolean $utc Whether the time stamp is UTC or local |
||||
* @return mixed ISO 8601 date string or false |
||||
* @access public |
||||
*/ |
||||
function timestamp_to_iso8601($timestamp,$utc=true){ |
||||
$datestr = date('Y-m-d\TH:i:sO',$timestamp); |
||||
$pos = strrpos($datestr, "+"); |
||||
if ($pos === FALSE) { |
||||
$pos = strrpos($datestr, "-"); |
||||
} |
||||
if ($pos !== FALSE) { |
||||
if (strlen($datestr) == $pos + 5) { |
||||
$datestr = substr($datestr, 0, $pos + 3) . ':' . substr($datestr, -2); |
||||
} |
||||
} |
||||
if($utc){ |
||||
$pattern = '/'. |
||||
'([0-9]{4})-'. // centuries & years CCYY- |
||||
'([0-9]{2})-'. // months MM- |
||||
'([0-9]{2})'. // days DD |
||||
'T'. // separator T |
||||
'([0-9]{2}):'. // hours hh: |
||||
'([0-9]{2}):'. // minutes mm: |
||||
'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss... |
||||
'(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's |
||||
'/'; |
||||
|
||||
if(preg_match($pattern,$datestr,$regs)){ |
||||
return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]); |
||||
} |
||||
return false; |
||||
} else { |
||||
return $datestr; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* convert ISO 8601 compliant date string to unix timestamp |
||||
* |
||||
* @param string $datestr ISO 8601 compliant date string |
||||
* @return mixed Unix timestamp (int) or false |
||||
* @access public |
||||
*/ |
||||
function iso8601_to_timestamp($datestr){ |
||||
$pattern = '/'. |
||||
'([0-9]{4})-'. // centuries & years CCYY- |
||||
'([0-9]{2})-'. // months MM- |
||||
'([0-9]{2})'. // days DD |
||||
'T'. // separator T |
||||
'([0-9]{2}):'. // hours hh: |
||||
'([0-9]{2}):'. // minutes mm: |
||||
'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss... |
||||
'(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's |
||||
'/'; |
||||
if(preg_match($pattern,$datestr,$regs)){ |
||||
// not utc |
||||
if($regs[8] != 'Z'){ |
||||
$op = substr($regs[8],0,1); |
||||
$h = substr($regs[8],1,2); |
||||
$m = substr($regs[8],strlen($regs[8])-2,2); |
||||
if($op == '-'){ |
||||
$regs[4] = $regs[4] + $h; |
||||
$regs[5] = $regs[5] + $m; |
||||
} elseif($op == '+'){ |
||||
$regs[4] = $regs[4] - $h; |
||||
$regs[5] = $regs[5] - $m; |
||||
} |
||||
} |
||||
return gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); |
||||
// return strtotime("$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z"); |
||||
} else { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* sleeps some number of microseconds |
||||
* |
||||
* @param string $usec the number of microseconds to sleep |
||||
* @access public |
||||
* @deprecated |
||||
*/ |
||||
function usleepWindows($usec) |
||||
{ |
||||
$start = gettimeofday(); |
||||
|
||||
do |
||||
{ |
||||
$stop = gettimeofday(); |
||||
$timePassed = 1000000 * ($stop['sec'] - $start['sec']) |
||||
+ $stop['usec'] - $start['usec']; |
||||
} |
||||
while ($timePassed < $usec); |
||||
} |
||||
|
||||
|
||||
?> |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue