diff options
author | Dmitry Stogov <dmitry@php.net> | 2007-03-20 09:52:14 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2007-03-20 09:52:14 +0000 |
commit | 3ee54ce92464994cb39f45924a75bc5f31992f49 (patch) | |
tree | ae56c8081edefe6db24e92201d168dc1046578ef /ext/soap/php_encoding.c | |
parent | ef06bfa3ec23b456dc57e47c6542988c44d8e958 (diff) | |
download | php-git-3ee54ce92464994cb39f45924a75bc5f31992f49.tar.gz |
Added ability to encode arrays with "SOAP-ENC:Array" type instead of WSDL type. To activate the ability use "feature"=>SOAP_USE_XSI_ARRAY_TYPE option in SoapClient/SoapServer constructors.
Diffstat (limited to 'ext/soap/php_encoding.c')
-rw-r--r-- | ext/soap/php_encoding.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 83dd51c645..beeb99a38d 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1655,6 +1655,7 @@ static xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style, xmlNo xmlAddChild(parent, xmlParam); if (style == SOAP_ENCODED) { set_xsi_nil(xmlParam); + set_ns_and_type(xmlParam, type); } return xmlParam; } @@ -2047,7 +2048,17 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS")); xmlAddChild(parent, xmlParam); - FIND_ZVAL_NULL(data, xmlParam, style); + if (!data || Z_TYPE_P(data) == IS_NULL) { + if (style == SOAP_ENCODED) { + set_xsi_nil(xmlParam); + if (SOAP_GLOBAL(features) & SOAP_USE_XSI_ARRAY_TYPE) { + set_ns_and_type_ex(xmlParam, (soap_version == SOAP_1_1) ? SOAP_1_1_ENC_NAMESPACE : SOAP_1_2_ENC_NAMESPACE, "Array"); + } else { + set_ns_and_type(xmlParam, type); + } + } + return xmlParam; + } if (Z_TYPE_P(data) == IS_ARRAY) { sdlAttributePtr *arrayType; @@ -2220,7 +2231,11 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod efree(dims); } if (style == SOAP_ENCODED) { - set_ns_and_type(xmlParam, type); + if (SOAP_GLOBAL(features) & SOAP_USE_XSI_ARRAY_TYPE) { + set_ns_and_type_ex(xmlParam, (soap_version == SOAP_1_1) ? SOAP_1_1_ENC_NAMESPACE : SOAP_1_2_ENC_NAMESPACE, "Array"); + } else { + set_ns_and_type(xmlParam, type); + } } return xmlParam; } @@ -3026,9 +3041,9 @@ xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNo if (type->encode && (type->encode->details.type == IS_ARRAY || type->encode->details.type == SOAP_ENC_ARRAY)) { - ret = to_xml_array(enc, data, style, parent); + return to_xml_array(enc, data, style, parent); } else { - ret = to_xml_object(enc, data, style, parent); + return to_xml_object(enc, data, style, parent); } break; default: |