diff options
author | Dmitry Stogov <dmitry@php.net> | 2004-01-06 17:14:30 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2004-01-06 17:14:30 +0000 |
commit | 107a87ca8525faf65d73882ae923c669231fcdcc (patch) | |
tree | 4218044ddbc381b8340bf4c7a74383dcb2d11707 /ext/soap/php_sdl.c | |
parent | ea2f4b7ac08ada1e7a26d06250291c76e0c0adc3 (diff) | |
download | php-git-107a87ca8525faf65d73882ae923c669231fcdcc.tar.gz |
WSDL support was improved
Diffstat (limited to 'ext/soap/php_sdl.c')
-rw-r--r-- | ext/soap/php_sdl.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 80c8424922..82dd1a75b6 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -98,16 +98,19 @@ zval *sdl_guess_convert_zval(encodeType enc, xmlNodePtr data) type = enc.sdl_type; if(type->encode) { - if(type->encode->details.type == IS_ARRAY || - type->encode->details.type == SOAP_ENC_ARRAY) { - return to_zval_array(enc, data); - } else { +// if(type->encode->details.type == IS_ARRAY || +// type->encode->details.type == SOAP_ENC_ARRAY) { +// return to_zval_array(enc, data); +// } else if (type->encode->details.type == IS_OBJECT || +// type->encode->details.type == SOAP_ENC_OBJECT) { +// return to_zval_object(enc, data); +// } else { if (memcmp(&type->encode->details,&enc,sizeof(enc))!=0) { return master_to_zval(type->encode, data); } else { return master_to_zval(get_conversion(UNKNOWN_TYPE), data); } - } +// } } else if (type->elements) { return to_zval_object(enc, data); } else { @@ -122,10 +125,23 @@ xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval *data, int style) type = enc.sdl_type; + if (type->restrictions) { + if (type->restrictions->enumeration) { + if (Z_TYPE_P(data) == IS_STRING) { + if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRLEN_P(data)+1)) { + php_error(E_WARNING,"Restriction: invalid enumeration value \"%s\".",Z_STRVAL_P(data)); + } + } + } + } + if(type->encode) { - if(type->encode->details.type == IS_ARRAY || + if (type->encode->details.type == IS_ARRAY || type->encode->details.type == SOAP_ENC_ARRAY) { ret = sdl_to_xml_array(type, data, style); + } else if (type->encode->details.type == IS_OBJECT || + type->encode->details.type == SOAP_ENC_OBJECT) { + ret = sdl_to_xml_object(type, data, style); } else { if (memcmp(&type->encode->details,&enc,sizeof(enc))!=0) { ret = master_to_xml(type->encode, data, style); @@ -612,6 +628,8 @@ sdlPtr load_wsdl(char *struri, sdlPtr parent) else tmpsdl = parent; + /* TODO: WSDL Caching */ + wsdl = xmlParseFile(struri); xmlCleanupParser(); @@ -1174,8 +1192,10 @@ void delete_type(void *data) delete_restriction_var_int(&type->restrictions->maxLength); delete_schema_restriction_var_char(&type->restrictions->whiteSpace); delete_schema_restriction_var_char(&type->restrictions->pattern); - zend_hash_destroy(type->restrictions->enumeration); - free(type->restrictions->enumeration); + if (type->restrictions->enumeration) { + zend_hash_destroy(type->restrictions->enumeration); + free(type->restrictions->enumeration); + } free(type->restrictions); } free(type); |