WSDL support was improved

This commit is contained in:
Dmitry Stogov 2004-01-06 17:14:30 +00:00
parent ea2f4b7ac0
commit 107a87ca85
7 changed files with 370 additions and 317 deletions

View file

@ -55,6 +55,46 @@ WSDL
? support for style "rpc"/"document" encoding ? support for style "rpc"/"document" encoding
? support for "encoded"/"literal" encoding ? support for "encoded"/"literal" encoding
? support for "nillable" and "nil" ? support for "nillable" and "nil"
- support for user defined simple types
- restiction
+ base
- minExclusive (for numeric, date types)
- minInclusive (for numeric, date types)
- maxExclusive (for numeric, date types)
- maxInclusive (for numeric, date types)
- totalDigits (for decimal)
- fractionDigits (for decimal)
- length (for string, anyURI, hexBinary, base64Binary and derived)
- minLength (for string, hexBinary, base64Binary and derived)
- maxLength (for string, hexBinary, base64Binary and derived)
- whiteSpace (preserve, replace [#x9,#xA,#xD=>#x20], collapse [replace+?])
- pattern
? enumeration
- list ???
- union ???
- support for user defined complex types
- simpleContent extension
? base
- group
- name
- all
- choice
- sequence
- all
- element
- choice
- element
- group
- choice
- sequence
- any ???
- sequence
- element
- group
- choice
- sequence
- any ???
- attribute
- function/method overloading (test(int); test(string)) - function/method overloading (test(int); test(string))
- wsdl caching - wsdl caching
- wsdl auto generation - wsdl auto generation
@ -65,7 +105,7 @@ Error Handling
Transport Transport
--------- ---------
? support for https:// + support for https://
- support for persistent HTTP connections (keep_alive) - support for persistent HTTP connections (keep_alive)
- support for HTTP compression (gzip,x-gzip,defalte) - support for HTTP compression (gzip,x-gzip,defalte)
- support for HTTP athentication - support for HTTP athentication

View file

@ -20,6 +20,7 @@ encode defaultEncoding[] = {
{{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string}, {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
{{XSD_FLOAT, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double}, {{XSD_FLOAT, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double},
{{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double}, {{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double},
{{XSD_DATETIME, XSD_DATETIME_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_datetime}, {{XSD_DATETIME, XSD_DATETIME_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_datetime},
{{XSD_TIME, XSD_TIME_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_time}, {{XSD_TIME, XSD_TIME_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_time},
{{XSD_DATE, XSD_DATE_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_date}, {{XSD_DATE, XSD_DATE_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_date},
@ -28,6 +29,8 @@ encode defaultEncoding[] = {
{{XSD_GMONTHDAY, XSD_GMONTHDAY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gmonthday}, {{XSD_GMONTHDAY, XSD_GMONTHDAY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gmonthday},
{{XSD_GDAY, XSD_GDAY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gday}, {{XSD_GDAY, XSD_GDAY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gday},
{{XSD_GMONTH, XSD_GMONTH_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gmonth}, {{XSD_GMONTH, XSD_GMONTH_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_gmonth},
{{XSD_DURATION, XSD_DURATION_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_duration},
{{XSD_HEXBINARY, XSD_HEXBINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_stringl}, {{XSD_HEXBINARY, XSD_HEXBINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_stringl},
{{XSD_BASE64BINARY, XSD_BASE64BINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_stringl}, {{XSD_BASE64BINARY, XSD_BASE64BINARY_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_stringl},
@ -42,6 +45,7 @@ encode defaultEncoding[] = {
{{XSD_UNSIGNEDBYTE, XSD_UNSIGNEDBYTE_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long}, {{XSD_UNSIGNEDBYTE, XSD_UNSIGNEDBYTE_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
{{XSD_UNSIGNEDSHORT, XSD_UNSIGNEDSHORT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long}, {{XSD_UNSIGNEDSHORT, XSD_UNSIGNEDSHORT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
{{XSD_UNSIGNEDINT, XSD_UNSIGNEDINT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long}, {{XSD_UNSIGNEDINT, XSD_UNSIGNEDINT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
{{XSD_UNSIGNEDLONG, XSD_UNSIGNEDLONG_STRING, XSD_NAMESPACE, NULL}, to_zval_ulong, to_xml_ulong},
{{APACHE_MAP, APACHE_MAP_STRING, APACHE_NAMESPACE, NULL}, to_zval_map, to_xml_map}, {{APACHE_MAP, APACHE_MAP_STRING, APACHE_NAMESPACE, NULL}, to_zval_map, to_xml_map},
@ -54,48 +58,14 @@ encode defaultEncoding[] = {
{{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string}, {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string},
{{XSD_FLOAT, XSD_FLOAT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_double}, {{XSD_FLOAT, XSD_FLOAT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_double},
{{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_double}, {{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_double},
{{XSD_LONG, XSD_LONG_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long}, {{XSD_LONG, XSD_LONG_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
{{XSD_INT, XSD_INT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long}, {{XSD_INT, XSD_INT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
{{XSD_SHORT, XSD_SHORT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long}, {{XSD_SHORT, XSD_SHORT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
{{XSD_BYTE, XSD_BYTE_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
{{XSD_1999_TIMEINSTANT, XSD_1999_TIMEINSTANT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string}, {{XSD_1999_TIMEINSTANT, XSD_1999_TIMEINSTANT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string},
{{END_KNOWN_TYPES, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert} {{END_KNOWN_TYPES, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert}
/* TODO: finish off encoding */
/*
#define XSD_DURATION 107
#define XSD_DURATION_STRING "duration"
#define XSD_ANYURI 118
#define XSD_ANYURI_STRING "anyURI"
#define XSD_QNAME 119
#define XSD_QNAME_STRING "QName"
#define XSD_NOTATION 120
#define XSD_NOTATION_STRING "NOTATION"
#define XSD_NORMALIZEDSTRING 121
#define XSD_NORMALIZEDSTRING_STRING "normalizedString"
#define XSD_TOKEN 122
#define XSD_TOKEN_STRING "token"
#define XSD_LANGUAGE 123
#define XSD_LANGUAGE_STRING "language"
#define XSD_NMTOKEN 124
#define XSD_NMTOKEN_STRING "NMTOKEN"
#define XSD_NAME 124
#define XSD_NAME_STRING "Name"
#define XSD_NCNAME 125
#define XSD_NCNAME_STRING "NCName"
#define XSD_ID 126
#define XSD_ID_STRING "ID"
#define XSD_IDREF 127
#define XSD_IDREF_STRING "IDREF"
#define XSD_IDREFS 127
#define XSD_IDREFS_STRING "IDREFS"
#define XSD_ENTITY 128
#define XSD_ENTITY_STRING "ENTITY"
#define XSD_ENTITYS 129
#define XSD_ENTITYS_STRING "ENTITYS"
#define XSD_UNSIGNEDLONG 138
#define XSD_UNSIGNEDLONG_STRING "unsignedLong"
*/
}; };
xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style) xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style)
@ -358,6 +328,21 @@ zval *to_zval_long(encodeType type, xmlNodePtr data)
return ret; return ret;
} }
zval *to_zval_ulong(encodeType type, xmlNodePtr data)
{
zval *ret;
MAKE_STD_ZVAL(ret);
FIND_XML_NULL(data, ret);
if (data && data->children && data->children->content) {
/* TODO: long overflow */
ZVAL_LONG(ret, atol(data->children->content));
} else {
ZVAL_NULL(ret);
}
return ret;
}
xmlNodePtr to_xml_long(encodeType type, zval *data, int style) xmlNodePtr to_xml_long(encodeType type, zval *data, int style)
{ {
xmlNodePtr ret; xmlNodePtr ret;
@ -380,6 +365,29 @@ xmlNodePtr to_xml_long(encodeType type, zval *data, int style)
return ret; return ret;
} }
xmlNodePtr to_xml_ulong(encodeType type, zval *data, int style)
{
xmlNodePtr ret;
zval tmp;
ret = xmlNewNode(NULL, "BOGUS");
FIND_ZVAL_NULL(data, ret, style);
/* TODO: long overflow */
tmp = *data;
zval_copy_ctor(&tmp);
if (Z_TYPE(tmp) != IS_LONG) {
convert_to_long(&tmp);
}
convert_to_string(&tmp);
xmlNodeSetContentLen(ret, Z_STRVAL(tmp), Z_STRLEN(tmp));
zval_dtor(&tmp);
if(style == SOAP_ENCODED)
set_ns_and_type(ret, type);
return ret;
}
xmlNodePtr to_xml_double(encodeType type, zval *data, int style) xmlNodePtr to_xml_double(encodeType type, zval *data, int style)
{ {
xmlNodePtr ret; xmlNodePtr ret;
@ -1055,44 +1063,59 @@ xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int sty
return xmlParam; return xmlParam;
} }
xmlNodePtr to_xml_duration(encodeType type, zval *data, int style)
{
/* TODO: '-'?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?T([0-9]+H)?([0-9]+M)?([0-9]+S)? */
return to_xml_string(type, data, style);
}
xmlNodePtr to_xml_datetime(encodeType type, zval *data, int style) xmlNodePtr to_xml_datetime(encodeType type, zval *data, int style)
{ {
/* TODO: time zone */
return to_xml_datetime_ex(type, data, "%Y-%m-%dT%H:%M:%S", style); return to_xml_datetime_ex(type, data, "%Y-%m-%dT%H:%M:%S", style);
} }
xmlNodePtr to_xml_time(encodeType type, zval *data, int style) xmlNodePtr to_xml_time(encodeType type, zval *data, int style)
{ {
/* TODO: time zone */
/* TODO: microsecconds */
return to_xml_datetime_ex(type, data, "%H:%M:%S", style); return to_xml_datetime_ex(type, data, "%H:%M:%S", style);
} }
xmlNodePtr to_xml_date(encodeType type, zval *data, int style) xmlNodePtr to_xml_date(encodeType type, zval *data, int style)
{ {
/* TODO: time zone */
return to_xml_datetime_ex(type, data, "%Y-%m-%d", style); return to_xml_datetime_ex(type, data, "%Y-%m-%d", style);
} }
xmlNodePtr to_xml_gyearmonth(encodeType type, zval *data, int style) xmlNodePtr to_xml_gyearmonth(encodeType type, zval *data, int style)
{ {
/* TODO: time zone */
return to_xml_datetime_ex(type, data, "%Y-%m", style); return to_xml_datetime_ex(type, data, "%Y-%m", style);
} }
xmlNodePtr to_xml_gyear(encodeType type, zval *data, int style) xmlNodePtr to_xml_gyear(encodeType type, zval *data, int style)
{ {
/* TODO: time zone */
return to_xml_datetime_ex(type, data, "%Y", style); return to_xml_datetime_ex(type, data, "%Y", style);
} }
xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style) xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style)
{ {
/* TODO: time zone */
return to_xml_datetime_ex(type, data, "--%m-%d", style); return to_xml_datetime_ex(type, data, "--%m-%d", style);
} }
xmlNodePtr to_xml_gday(encodeType type, zval *data, int style) xmlNodePtr to_xml_gday(encodeType type, zval *data, int style)
{ {
return to_xml_datetime_ex(type, data, "%d", style); /* TODO: time zone */
return to_xml_datetime_ex(type, data, "---%d", style);
} }
xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style) xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style)
{ {
return to_xml_datetime_ex(type, data, "%m", style); /* TODO: time zone */
return to_xml_datetime_ex(type, data, "--%m--", style);
} }
void set_ns_and_type(xmlNodePtr node, encodeType type) void set_ns_and_type(xmlNodePtr node, encodeType type)

View file

@ -5,10 +5,12 @@
#define XSD_1999_TIMEINSTANT 401 #define XSD_1999_TIMEINSTANT 401
#define XSD_1999_TIMEINSTANT_STRING "timeInstant" #define XSD_1999_TIMEINSTANT_STRING "timeInstant"
#define SCHEMA_NAMESPACE "http://www.w3.org/2001/XMLSchema"
#define XSD_NAMESPACE "http://www.w3.org/2001/XMLSchema" #define XSD_NAMESPACE "http://www.w3.org/2001/XMLSchema"
#define XSD_NS_PREFIX "xsd" #define XSD_NS_PREFIX "xsd"
#define XSI_NAMESPACE "http://www.w3.org/2001/XMLSchema-instance" #define XSI_NAMESPACE "http://www.w3.org/2001/XMLSchema-instance"
#define XSI_NS_PREFIX "xsi" #define XSI_NS_PREFIX "xsi"
#define XSD_STRING 101 #define XSD_STRING 101
#define XSD_STRING_STRING "string" #define XSD_STRING_STRING "string"
#define XSD_BOOLEAN 103 #define XSD_BOOLEAN 103
@ -108,9 +110,6 @@
#define SOAP_ENC_OBJECT 301 #define SOAP_ENC_OBJECT 301
#define SOAP_ENC_OBJECT_STRING "Struct" #define SOAP_ENC_OBJECT_STRING "Struct"
#define SCHEMA_NAMESPACE "http://www.w3.org/2001/XMLSchema"
#define SCHEMA_NS_PREFIX "s"
#define WSDL_NAMESPACE "http://schemas.xmlsoap.org/wsdl/" #define WSDL_NAMESPACE "http://schemas.xmlsoap.org/wsdl/"
#define WSDL_NS_PREFIX "wsdl" #define WSDL_NS_PREFIX "wsdl"
@ -125,8 +124,7 @@
#define UNKNOWN_TYPE 999998 #define UNKNOWN_TYPE 999998
#define END_KNOWN_TYPES 999999 #define END_KNOWN_TYPES 999999
struct _encodeType struct _encodeType {
{
int type; int type;
char *type_str; char *type_str;
char *ns; char *ns;
@ -134,8 +132,7 @@ struct _encodeType
soapMappingPtr map; soapMappingPtr map;
}; };
struct _encode struct _encode {
{
encodeType details; encodeType details;
zval *(*to_zval)(encodeType type, xmlNodePtr data); zval *(*to_zval)(encodeType type, xmlNodePtr data);
xmlNodePtr (*to_xml)(encodeType type, zval *data, int style); xmlNodePtr (*to_xml)(encodeType type, zval *data, int style);
@ -166,6 +163,7 @@ zval *to_zval_after_user(encodeType type, zval *data);
/* zval type decode */ /* zval type decode */
zval *to_zval_double(encodeType type, xmlNodePtr data); zval *to_zval_double(encodeType type, xmlNodePtr data);
zval *to_zval_long(encodeType type, xmlNodePtr data); zval *to_zval_long(encodeType type, xmlNodePtr data);
zval *to_zval_ulong(encodeType type, xmlNodePtr data);
zval *to_zval_bool(encodeType type, xmlNodePtr data); zval *to_zval_bool(encodeType type, xmlNodePtr data);
zval *to_zval_object(encodeType type, xmlNodePtr data); zval *to_zval_object(encodeType type, xmlNodePtr data);
zval *to_zval_string(encodeType type, xmlNodePtr data); zval *to_zval_string(encodeType type, xmlNodePtr data);
@ -175,6 +173,7 @@ zval *to_zval_null(encodeType type, xmlNodePtr data);
zval *guess_zval_convert(encodeType type, xmlNodePtr data); zval *guess_zval_convert(encodeType type, xmlNodePtr data);
xmlNodePtr to_xml_long(encodeType type, zval *data, int style); xmlNodePtr to_xml_long(encodeType type, zval *data, int style);
xmlNodePtr to_xml_ulong(encodeType type, zval *data, int style);
xmlNodePtr to_xml_double(encodeType type, zval *data, int style); xmlNodePtr to_xml_double(encodeType type, zval *data, int style);
xmlNodePtr to_xml_bool(encodeType type, zval *data, int style); xmlNodePtr to_xml_bool(encodeType type, zval *data, int style);
@ -206,6 +205,7 @@ xmlNodePtr to_xml_gyear(encodeType type, zval *data, int style);
xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style); xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style);
xmlNodePtr to_xml_gday(encodeType type, zval *data, int style); xmlNodePtr to_xml_gday(encodeType type, zval *data, int style);
xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style); xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style);
xmlNodePtr to_xml_duration(encodeType type, zval *data, int style);
#define get_conversion(e) get_conversion_ex(SOAP_GLOBAL(defEncIndex), e) #define get_conversion(e) get_conversion_ex(SOAP_GLOBAL(defEncIndex), e)
#define get_conversion_from_type(n, t) get_conversion_from_type_ex(SOAP_GLOBAL(defEnc), n, t) #define get_conversion_from_type(n, t) get_conversion_from_type_ex(SOAP_GLOBAL(defEnc), n, t)

View file

@ -9,7 +9,8 @@ static int schema_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpComp
static int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type); static int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
static int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type); static int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
static int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type); static int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restType, sdlTypePtr cur_type);
static int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type); static int schema_extension_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
static int schema_extension_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
static int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type); static int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
static int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type); static int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type);
static int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type); static int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr cur_type);
@ -18,10 +19,8 @@ static int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sd
static int schema_any(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type); static int schema_any(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type);
static int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr); static int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr);
static void delete_restriction_var_int(void *rvi);
static int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr); static int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr);
static void delete_schema_restriction_var_char(void *srvc);
/* /*
2.6.1 xsi:type 2.6.1 xsi:type
2.6.2 xsi:nil 2.6.2 xsi:nil
@ -47,8 +46,7 @@ int load_schema(sdlPtr *sdl,xmlNodePtr schema)
xmlNodePtr trav, element, compType, simpleType, attribute; xmlNodePtr trav, element, compType, simpleType, attribute;
xmlAttrPtr tns; xmlAttrPtr tns;
if(!(*sdl)->types) if(!(*sdl)->types) {
{
(*sdl)->types = malloc(sizeof(HashTable)); (*sdl)->types = malloc(sizeof(HashTable));
zend_hash_init((*sdl)->types, 0, NULL, delete_type, 1); zend_hash_init((*sdl)->types, 0, NULL, delete_type, 1);
} }
@ -56,29 +54,25 @@ int load_schema(sdlPtr *sdl,xmlNodePtr schema)
tns = get_attribute(schema->properties, "targetNamespace"); tns = get_attribute(schema->properties, "targetNamespace");
trav = schema->children; trav = schema->children;
FOREACHNODE(trav,"complexType",compType) FOREACHNODE(trav,"complexType",compType) {
{
schema_complexType(sdl, tns, compType, NULL); schema_complexType(sdl, tns, compType, NULL);
} }
ENDFOREACH(trav); ENDFOREACH(trav);
trav = schema->children; trav = schema->children;
FOREACHNODE(trav,"simpleType",simpleType) FOREACHNODE(trav,"simpleType",simpleType) {
{
schema_simpleType(sdl, tns, simpleType, NULL); schema_simpleType(sdl, tns, simpleType, NULL);
} }
ENDFOREACH(trav); ENDFOREACH(trav);
trav = schema->children; trav = schema->children;
FOREACHNODE(trav,"element",element) FOREACHNODE(trav,"element",element) {
{
schema_element(sdl, tns, element, NULL); schema_element(sdl, tns, element, NULL);
} }
ENDFOREACH(trav); ENDFOREACH(trav);
trav = schema->children; trav = schema->children;
FOREACHNODE(trav, "attribute", attribute) FOREACHNODE(trav, "attribute", attribute) {
{
schema_attribute(sdl, tns, attribute, NULL); schema_attribute(sdl, tns, attribute, NULL);
} }
ENDFOREACH(trav); ENDFOREACH(trav);
@ -99,12 +93,12 @@ static int schema_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpleType,
xmlAttrPtr name, ns; xmlAttrPtr name, ns;
ns = get_attribute(simpleType->properties, "targetNamespace"); ns = get_attribute(simpleType->properties, "targetNamespace");
if(ns == NULL) if(ns == NULL) {
ns = tsn; ns = tsn;
}
name = get_attribute(simpleType->properties, "name"); name = get_attribute(simpleType->properties, "name");
if(name != NULL) if(name != NULL) {
{
HashTable *ht; HashTable *ht;
smart_str key = {0}; smart_str key = {0};
sdlTypePtr newType, *ptr; sdlTypePtr newType, *ptr;
@ -114,18 +108,14 @@ static int schema_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpleType,
newType->name = strdup(name->children->content); newType->name = strdup(name->children->content);
newType->namens = strdup(ns->children->content); newType->namens = strdup(ns->children->content);
if(cur_type == NULL) if(cur_type == NULL) {
{
ht = (*sdl)->types; ht = (*sdl)->types;
smart_str_appends(&key, newType->namens); smart_str_appends(&key, newType->namens);
smart_str_appendc(&key, ':'); smart_str_appendc(&key, ':');
smart_str_appends(&key, newType->name); smart_str_appends(&key, newType->name);
smart_str_0(&key); smart_str_0(&key);
} } else {
else if(cur_type->elements == NULL) {
{
if(cur_type->elements == NULL)
{
cur_type->elements = malloc(sizeof(HashTable)); cur_type->elements = malloc(sizeof(HashTable));
zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1); zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
} }
@ -135,26 +125,24 @@ static int schema_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpleType,
zend_hash_add(ht, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), (void **)&ptr); zend_hash_add(ht, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), (void **)&ptr);
cur_type = (*ptr); cur_type = (*ptr);
create_encoder((*sdl), cur_type, ns->children->content, name->children->content);
smart_str_free(&key); smart_str_free(&key);
} }
content = get_node(simpleType->children, "restriction"); content = get_node(simpleType->children, "restriction");
if(content != NULL) if(content != NULL) {
{
schema_restriction_simpleType(sdl, tsn, content, cur_type); schema_restriction_simpleType(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(simpleType->children, "list"); content = get_node(simpleType->children, "list");
if(content != NULL) if(content != NULL) {
{
schema_list(sdl, tsn, content, cur_type); schema_list(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(simpleType->children, "union"); content = get_node(simpleType->children, "union");
if(content != NULL) if(content != NULL) {
{
schema_union(sdl, tsn, content, cur_type); schema_union(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
@ -200,17 +188,15 @@ static int schema_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpComp
xmlNodePtr content; xmlNodePtr content;
content = get_node(simpCompType->children, "restriction"); content = get_node(simpCompType->children, "restriction");
if(content == NULL) if(content != NULL) {
{
schema_restriction_simpleContent(sdl, tsn, content, cur_type); schema_restriction_simpleContent(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(simpCompType->children, "extension"); content = get_node(simpCompType->children, "extension");
if(content == NULL) if(content != NULL) {
{ schema_extension_simpleContent(sdl, tsn, content, cur_type);
/* schema_extension(sdl, tsn, content, cur_type); */ // php_error(E_ERROR, "Error parsing schema (doesn't support extensions on simpleContent)");
php_error(E_ERROR, "Error parsing schema (doesn't support extensions on simpleContent)");
return TRUE; return TRUE;
} }
@ -232,63 +218,64 @@ static int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr
xmlAttrPtr base; xmlAttrPtr base;
content = get_node(restType->children, "simpleType"); content = get_node(restType->children, "simpleType");
if(content != NULL) if(content != NULL) {
{
schema_simpleType(sdl, tsn, content, cur_type); schema_simpleType(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
base = get_attribute(restType->properties, "base"); base = get_attribute(restType->properties, "base");
if(base != NULL) if(base != NULL) {
{ char *type, *ns;
/* xmlNsPtr nsptr;
cur_type->base = estrdup(base->children->content);
*/ parse_namespace(base->children->content, &type, &ns);
nsptr = xmlSearchNs(restType->doc, restType, ns);
if(nsptr != NULL) {
cur_type->encode = get_encoder((*sdl), (char *)nsptr->href, type);
}
if(type) {efree(type);}
if(ns) {efree(ns);}
} }
if(cur_type->restrictions == NULL) if(cur_type->restrictions == NULL) {
{
cur_type->restrictions = malloc(sizeof(sdlRestrictions)); cur_type->restrictions = malloc(sizeof(sdlRestrictions));
memset(cur_type->restrictions, 0, sizeof(sdlRestrictions)); memset(cur_type->restrictions, 0, sizeof(sdlRestrictions));
} }
trav = restType->children; trav = restType->children;
while (trav != NULL) { while (trav != NULL) {
if(trav->type == XML_ELEMENT_NODE) if(trav->type == XML_ELEMENT_NODE) {
{ if(!strcmp(trav->name, "minExclusive")) {
if(!strcmp(trav->name, "minExclusive"))
schema_restriction_var_int(trav, &cur_type->restrictions->minExclusive); schema_restriction_var_int(trav, &cur_type->restrictions->minExclusive);
else if(!strcmp(trav->name, "minInclusive")) } else if(!strcmp(trav->name, "minInclusive")) {
schema_restriction_var_int(trav, &cur_type->restrictions->minInclusive); schema_restriction_var_int(trav, &cur_type->restrictions->minInclusive);
else if(!strcmp(trav->name, "maxExclusive")) } else if(!strcmp(trav->name, "maxExclusive")) {
schema_restriction_var_int(trav, &cur_type->restrictions->maxExclusive); schema_restriction_var_int(trav, &cur_type->restrictions->maxExclusive);
else if(!strcmp(trav->name, "maxInclusive")) } else if(!strcmp(trav->name, "maxInclusive")) {
schema_restriction_var_int(trav, &cur_type->restrictions->maxInclusive); schema_restriction_var_int(trav, &cur_type->restrictions->maxInclusive);
else if(!strcmp(trav->name, "totalDigits")) } else if(!strcmp(trav->name, "totalDigits")) {
schema_restriction_var_int(trav, &cur_type->restrictions->totalDigits); schema_restriction_var_int(trav, &cur_type->restrictions->totalDigits);
else if(!strcmp(trav->name, "fractionDigits")) } else if(!strcmp(trav->name, "fractionDigits")) {
schema_restriction_var_int(trav, &cur_type->restrictions->fractionDigits); schema_restriction_var_int(trav, &cur_type->restrictions->fractionDigits);
else if(!strcmp(trav->name, "length")) } else if(!strcmp(trav->name, "length")) {
schema_restriction_var_int(trav, &cur_type->restrictions->length); schema_restriction_var_int(trav, &cur_type->restrictions->length);
else if(!strcmp(trav->name, "minLength")) } else if(!strcmp(trav->name, "minLength")) {
schema_restriction_var_int(trav, &cur_type->restrictions->minLength); schema_restriction_var_int(trav, &cur_type->restrictions->minLength);
else if(!strcmp(trav->name, "maxLength")) } else if(!strcmp(trav->name, "maxLength")) {
schema_restriction_var_int(trav, &cur_type->restrictions->maxLength); schema_restriction_var_int(trav, &cur_type->restrictions->maxLength);
else if(!strcmp(trav->name, "whiteSpace")) } else if(!strcmp(trav->name, "whiteSpace")) {
schema_restriction_var_char(trav, &cur_type->restrictions->whiteSpace); schema_restriction_var_char(trav, &cur_type->restrictions->whiteSpace);
else if(!strcmp(trav->name, "pattern")) } else if(!strcmp(trav->name, "pattern")) {
schema_restriction_var_char(trav, &cur_type->restrictions->pattern); schema_restriction_var_char(trav, &cur_type->restrictions->pattern);
else if(!strcmp(trav->name, "enumeration")) } else if(!strcmp(trav->name, "enumeration")) {
{
sdlRestrictionCharPtr enumval = NULL; sdlRestrictionCharPtr enumval = NULL;
schema_restriction_var_char(trav, &enumval); schema_restriction_var_char(trav, &enumval);
if(cur_type->restrictions->enumeration == NULL) if(cur_type->restrictions->enumeration == NULL) {
{
cur_type->restrictions->enumeration = malloc(sizeof(HashTable)); cur_type->restrictions->enumeration = malloc(sizeof(HashTable));
zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_schema_restriction_var_char, 1); zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_schema_restriction_var_char, 1);
} }
zend_hash_next_index_insert(cur_type->restrictions->enumeration, &enumval, sizeof(sdlRestrictionCharPtr), NULL); zend_hash_add(cur_type->restrictions->enumeration, enumval->value, strlen(enumval->value)+1, &enumval, sizeof(sdlRestrictionCharPtr), NULL);
} }
} }
trav = trav->next; trav = trav->next;
@ -311,47 +298,35 @@ static int schema_restriction_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNod
xmlNodePtr trav; xmlNodePtr trav;
base = get_attribute(restType->properties, "base"); base = get_attribute(restType->properties, "base");
if(base != NULL) if(base != NULL) {
{
char *type, *ns; char *type, *ns;
xmlNsPtr nsptr; xmlNsPtr nsptr;
parse_namespace(base->children->content, &type, &ns); parse_namespace(base->children->content, &type, &ns);
nsptr = xmlSearchNs(restType->doc, restType, ns); nsptr = xmlSearchNs(restType->doc, restType, ns);
if(nsptr != NULL) if(nsptr != NULL) {
{
cur_type->encode = get_encoder((*sdl), (char *)nsptr->href, type); cur_type->encode = get_encoder((*sdl), (char *)nsptr->href, type);
} }
if(type) efree(type); if(type) {efree(type);}
if(ns) efree(ns); if(ns) {efree(ns);}
} }
trav = restType->children; trav = restType->children;
while (trav != NULL) { while (trav != NULL) {
if(trav->type == XML_ELEMENT_NODE) if(trav->type == XML_ELEMENT_NODE) {
{ if(!strcmp(trav->name, "group")) {
if(!strcmp(trav->name, "group"))
{
schema_group(sdl, tsn, trav, cur_type); schema_group(sdl, tsn, trav, cur_type);
return TRUE; return TRUE;
} } else if(!strcmp(trav->name, "all")) {
else if(!strcmp(trav->name, "all"))
{
schema_all(sdl, tsn, trav, cur_type); schema_all(sdl, tsn, trav, cur_type);
return TRUE; return TRUE;
} } else if(!strcmp(trav->name, "choice")) {
else if(!strcmp(trav->name, "choice"))
{
schema_choice(sdl, tsn, trav, cur_type); schema_choice(sdl, tsn, trav, cur_type);
return TRUE; return TRUE;
} } else if(!strcmp(trav->name, "sequence")) {
else if(!strcmp(trav->name, "sequence"))
{
schema_sequence(sdl, tsn, trav, cur_type); schema_sequence(sdl, tsn, trav, cur_type);
return TRUE; return TRUE;
} } else if(!strcmp(trav->name, "attribute")) {
else if(!strcmp(trav->name, "attribute"))
{
schema_attribute(sdl, tsn, trav, cur_type); schema_attribute(sdl, tsn, trav, cur_type);
} }
} }
@ -379,52 +354,51 @@ static int schema_restriction_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNode
cur_type->encode = get_encoder_from_prefix((*sdl), restType, base->children->content); cur_type->encode = get_encoder_from_prefix((*sdl), restType, base->children->content);
content = get_node(restType->children, "simpleType"); content = get_node(restType->children, "simpleType");
if(content != NULL) if(content != NULL) {
{
schema_simpleType(sdl, tsn, content, cur_type); schema_simpleType(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
if(cur_type->restrictions == NULL) if(cur_type->restrictions == NULL) {
cur_type->restrictions = malloc(sizeof(sdlRestrictions)); cur_type->restrictions = malloc(sizeof(sdlRestrictions));
memset(cur_type->restrictions, 0, sizeof(sdlRestrictions));
}
trav = restType->children; trav = restType->children;
while (trav != NULL) { while (trav != NULL) {
if(trav->type == XML_ELEMENT_NODE) if(trav->type == XML_ELEMENT_NODE) {
{ if(!strcmp(trav->name, "minExclusive")) {
if(!strcmp(trav->name, "minExclusive"))
schema_restriction_var_int(trav, &cur_type->restrictions->minExclusive); schema_restriction_var_int(trav, &cur_type->restrictions->minExclusive);
else if(!strcmp(trav->name, "minInclusive")) } else if(!strcmp(trav->name, "minInclusive")) {
schema_restriction_var_int(trav, &cur_type->restrictions->minInclusive); schema_restriction_var_int(trav, &cur_type->restrictions->minInclusive);
else if(!strcmp(trav->name, "maxExclusive")) } else if(!strcmp(trav->name, "maxExclusive")) {
schema_restriction_var_int(trav, &cur_type->restrictions->maxExclusive); schema_restriction_var_int(trav, &cur_type->restrictions->maxExclusive);
else if(!strcmp(trav->name, "maxInclusive")) } else if(!strcmp(trav->name, "maxInclusive")) {
schema_restriction_var_int(trav, &cur_type->restrictions->maxInclusive); schema_restriction_var_int(trav, &cur_type->restrictions->maxInclusive);
else if(!strcmp(trav->name, "totalDigits")) } else if(!strcmp(trav->name, "totalDigits")) {
schema_restriction_var_int(trav, &cur_type->restrictions->totalDigits); schema_restriction_var_int(trav, &cur_type->restrictions->totalDigits);
else if(!strcmp(trav->name, "fractionDigits")) } else if(!strcmp(trav->name, "fractionDigits")) {
schema_restriction_var_int(trav, &cur_type->restrictions->fractionDigits); schema_restriction_var_int(trav, &cur_type->restrictions->fractionDigits);
else if(!strcmp(trav->name, "length")) } else if(!strcmp(trav->name, "length")) {
schema_restriction_var_int(trav, &cur_type->restrictions->length); schema_restriction_var_int(trav, &cur_type->restrictions->length);
else if(!strcmp(trav->name, "minLength")) } else if(!strcmp(trav->name, "minLength")) {
schema_restriction_var_int(trav, &cur_type->restrictions->minLength); schema_restriction_var_int(trav, &cur_type->restrictions->minLength);
else if(!strcmp(trav->name, "maxLength")) } else if(!strcmp(trav->name, "maxLength")) {
schema_restriction_var_int(trav, &cur_type->restrictions->maxLength); schema_restriction_var_int(trav, &cur_type->restrictions->maxLength);
else if(!strcmp(trav->name, "whiteSpace")) } else if(!strcmp(trav->name, "whiteSpace")) {
schema_restriction_var_char(trav, &cur_type->restrictions->whiteSpace); schema_restriction_var_char(trav, &cur_type->restrictions->whiteSpace);
else if(!strcmp(trav->name, "pattern")) } else if(!strcmp(trav->name, "pattern")) {
schema_restriction_var_char(trav, &cur_type->restrictions->pattern); schema_restriction_var_char(trav, &cur_type->restrictions->pattern);
else if(!strcmp(trav->name, "enumeration")) } else if(!strcmp(trav->name, "enumeration")) {
{
sdlRestrictionCharPtr enumval = NULL; sdlRestrictionCharPtr enumval = NULL;
schema_restriction_var_char(trav, &enumval); schema_restriction_var_char(trav, &enumval);
if(cur_type->restrictions->enumeration == NULL) if(cur_type->restrictions->enumeration == NULL) {
{
cur_type->restrictions->enumeration = malloc(sizeof(HashTable)); cur_type->restrictions->enumeration = malloc(sizeof(HashTable));
zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_schema_restriction_var_char, 1); zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_schema_restriction_var_char, 1);
} }
zend_hash_next_index_insert(cur_type->restrictions->enumeration, &enumval, sizeof(sdlRestrictionCharPtr), NULL); zend_hash_add(cur_type->restrictions->enumeration, enumval->value, strlen(enumval->value)+1, &enumval, sizeof(sdlRestrictionCharPtr), NULL);
// zend_hash_next_index_insert(cur_type->restrictions->enumeration, &enumval, sizeof(sdlRestrictionCharPtr), NULL);
} }
} }
trav = trav->next; trav = trav->next;
@ -437,75 +411,89 @@ static int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valp
{ {
xmlAttrPtr fixed, value, id; xmlAttrPtr fixed, value, id;
if((*valptr) == NULL) if((*valptr) == NULL) {
(*valptr) = malloc(sizeof(sdlRestrictionInt)); (*valptr) = malloc(sizeof(sdlRestrictionInt));
}
memset((*valptr), 0, sizeof(sdlRestrictionInt));
fixed = get_attribute(val->properties, "fixed"); fixed = get_attribute(val->properties, "fixed");
(*valptr)->fixed = FALSE; (*valptr)->fixed = FALSE;
if(fixed != NULL) if(fixed != NULL) {
{
if(!strcmp(fixed->children->content, "true") || if(!strcmp(fixed->children->content, "true") ||
!strcmp(fixed->children->content, "1")) !strcmp(fixed->children->content, "1"))
(*valptr)->fixed = TRUE; (*valptr)->fixed = TRUE;
} }
id = get_attribute(val->properties, "id"); id = get_attribute(val->properties, "id");
if(id != NULL) if(id != NULL) {
(*valptr)->id = strdup(id->children->content); (*valptr)->id = strdup(id->children->content);
}
value = get_attribute(val->properties, "value"); value = get_attribute(val->properties, "value");
if(value == NULL) if(value == NULL) {
php_error(E_ERROR, "Error parsing wsdl schema \"missing value for minExclusive\""); php_error(E_ERROR, "Error parsing wsdl schema \"missing restriction value\"");
}
(*valptr)->value = atoi(value->children->content); (*valptr)->value = atoi(value->children->content);
return TRUE; return TRUE;
} }
static void delete_restriction_var_int(void *rvi) void delete_restriction_var_int(void *rvi)
{ {
sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi); sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi);
if(ptr->id); if (ptr) {
if (ptr->id) {
free(ptr->id); free(ptr->id);
}
free(ptr); free(ptr);
}
} }
static int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr) static int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr)
{ {
xmlAttrPtr fixed, value, id; xmlAttrPtr fixed, value, id;
if((*valptr) == NULL) if((*valptr) == NULL) {
(*valptr) = malloc(sizeof(sdlRestrictionChar)); (*valptr) = malloc(sizeof(sdlRestrictionChar));
}
memset((*valptr), 0, sizeof(sdlRestrictionChar));
fixed = get_attribute(val->properties, "fixed"); fixed = get_attribute(val->properties, "fixed");
(*valptr)->fixed = FALSE; (*valptr)->fixed = FALSE;
if(fixed != NULL) if(fixed != NULL) {
{
if(!strcmp(fixed->children->content, "true") || if(!strcmp(fixed->children->content, "true") ||
!strcmp(fixed->children->content, "1")) !strcmp(fixed->children->content, "1")) {
(*valptr)->fixed = TRUE; (*valptr)->fixed = TRUE;
} }
}
id = get_attribute(val->properties, "id"); id = get_attribute(val->properties, "id");
if(id != NULL) if(id != NULL) {
(*valptr)->id = strdup(id->children->content); (*valptr)->id = strdup(id->children->content);
}
value = get_attribute(val->properties, "value"); value = get_attribute(val->properties, "value");
if(value == NULL) if(value == NULL) {
php_error(E_ERROR, "Error parsing wsdl schema \"missing value restriction\""); php_error(E_ERROR, "Error parsing wsdl schema \"missing restriction value\"");
}
(*valptr)->value = strdup(value->children->content); (*valptr)->value = strdup(value->children->content);
return TRUE; return TRUE;
} }
static void delete_schema_restriction_var_char(void *srvc) void delete_schema_restriction_var_char(void *srvc)
{ {
sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc); sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc);
if(ptr->id) if (ptr) {
if(ptr->id) {
free(ptr->id); free(ptr->id);
if(ptr->value) }
if(ptr->value) {
free(ptr->value); free(ptr->value);
}
free(ptr); free(ptr);
}
} }
/* /*
@ -516,7 +504,13 @@ From simpleContent (not supported):
{any attributes with non-schema namespace . . .}> {any attributes with non-schema namespace . . .}>
Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?)) Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?))
</extension> </extension>
*/
static int schema_extension_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type)
{
return TRUE;
}
/*
From complexContent: From complexContent:
<extension <extension
base = QName base = QName
@ -525,7 +519,7 @@ From complexContent:
Content: (annotation?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))) Content: (annotation?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))
</extension> </extension>
*/ */
static int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type) static int schema_extension_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type)
{ {
xmlNodePtr content; xmlNodePtr content;
xmlAttrPtr base; xmlAttrPtr base;
@ -533,29 +527,25 @@ static int schema_extension(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdl
base = get_attribute(extType->properties, "base"); base = get_attribute(extType->properties, "base");
content = get_node(extType->children, "group"); content = get_node(extType->children, "group");
if(content != NULL) if(content != NULL) {
{
schema_group(sdl, tsn, content, cur_type); schema_group(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(extType->children, "all"); content = get_node(extType->children, "all");
if(content != NULL) if(content != NULL) {
{
schema_all(sdl, tsn, content, cur_type); schema_all(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(extType->children, "choice"); content = get_node(extType->children, "choice");
if(content != NULL) if(content != NULL) {
{
schema_choice(sdl, tsn, content, cur_type); schema_choice(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(extType->children, "sequence"); content = get_node(extType->children, "sequence");
if(content != NULL) if(content != NULL) {
{
schema_sequence(sdl, tsn, content, cur_type); schema_sequence(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
@ -576,8 +566,7 @@ static int schema_all(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr all, sdlTypePtr cu
xmlNodePtr element, trav; xmlNodePtr element, trav;
trav = all->children; trav = all->children;
FOREACHNODE(trav, "element", element) FOREACHNODE(trav, "element", element) {
{
schema_element(sdl, tsn, element, cur_type); schema_element(sdl, tsn, element, cur_type);
} }
ENDFOREACH(trav); ENDFOREACH(trav);
@ -596,28 +585,24 @@ static int schema_group(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTy
xmlAttrPtr name; xmlAttrPtr name;
name = get_attribute(groupType->properties, "name"); name = get_attribute(groupType->properties, "name");
if(name != NULL) if(name != NULL) {
{
} }
content = get_node(groupType->children, "all"); content = get_node(groupType->children, "all");
if(content != NULL) if(content != NULL) {
{
schema_all(sdl, tsn, content, cur_type); schema_all(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(groupType->children, "choice"); content = get_node(groupType->children, "choice");
if(content != NULL) if(content != NULL) {
{
schema_choice(sdl, tsn, content, cur_type); schema_choice(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(groupType->children, "sequence"); content = get_node(groupType->children, "sequence");
if(content != NULL) if(content != NULL) {
{
schema_sequence(sdl, tsn, content, cur_type); schema_sequence(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
@ -641,36 +626,31 @@ static int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdl
*/ */
trav = choiceType->children; trav = choiceType->children;
FOREACHNODE(trav, "element", data) FOREACHNODE(trav, "element", data) {
{
schema_element(sdl, tsn, data, cur_type); schema_element(sdl, tsn, data, cur_type);
} }
ENDFOREACH(trav); ENDFOREACH(trav);
trav = choiceType->children; trav = choiceType->children;
FOREACHNODE(trav, "group", data) FOREACHNODE(trav, "group", data) {
{
schema_group(sdl, tsn, data, cur_type); schema_group(sdl, tsn, data, cur_type);
} }
ENDFOREACH(trav); ENDFOREACH(trav);
trav = choiceType->children; trav = choiceType->children;
FOREACHNODE(trav, "choice", data) FOREACHNODE(trav, "choice", data) {
{
schema_choice(sdl, tsn, data, cur_type); schema_choice(sdl, tsn, data, cur_type);
} }
ENDFOREACH(trav); ENDFOREACH(trav);
trav = choiceType->children; trav = choiceType->children;
FOREACHNODE(trav, "sequence", data) FOREACHNODE(trav, "sequence", data) {
{
schema_sequence(sdl, tsn, data, cur_type); schema_sequence(sdl, tsn, data, cur_type);
} }
ENDFOREACH(trav); ENDFOREACH(trav);
trav = choiceType->children; trav = choiceType->children;
FOREACHNODE(trav, "any", data) FOREACHNODE(trav, "any", data) {
{
schema_any(sdl, tsn, data, cur_type); schema_any(sdl, tsn, data, cur_type);
} }
ENDFOREACH(trav); ENDFOREACH(trav);
@ -693,26 +673,16 @@ static int schema_sequence(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlT
trav = seqType->children; trav = seqType->children;
while (trav != NULL) { while (trav != NULL) {
if(trav->type == XML_ELEMENT_NODE) if(trav->type == XML_ELEMENT_NODE) {
{ if(!strcmp(trav->name, "element")) {
if(!strcmp(trav->name, "element"))
{
schema_element(sdl, tsn, trav, cur_type); schema_element(sdl, tsn, trav, cur_type);
} } else if(!strcmp(trav->name, "group")) {
else if(!strcmp(trav->name, "group"))
{
schema_group(sdl, tsn, trav, cur_type); schema_group(sdl, tsn, trav, cur_type);
} } else if(!strcmp(trav->name, "choice")) {
else if(!strcmp(trav->name, "choice"))
{
schema_choice(sdl, tsn, trav, cur_type); schema_choice(sdl, tsn, trav, cur_type);
} } else if(!strcmp(trav->name, "sequence")) {
else if(!strcmp(trav->name, "sequence"))
{
schema_sequence(sdl, tsn, trav, cur_type); schema_sequence(sdl, tsn, trav, cur_type);
} } else if(!strcmp(trav->name, "any")) {
else if(!strcmp(trav->name, "any"))
{
schema_any(sdl, tsn, trav, cur_type); schema_any(sdl, tsn, trav, cur_type);
} }
} }
@ -740,12 +710,18 @@ static int schema_complexContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compCon
xmlNodePtr content; xmlNodePtr content;
content = get_node(compCont->children, "restriction"); content = get_node(compCont->children, "restriction");
if(content != NULL) if(content != NULL) {
{
schema_restriction_complexContent(sdl, tsn, content, cur_type); schema_restriction_complexContent(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(compCont->children, "extension");
if(content == NULL) {
// php_error(E_ERROR, "Error parsing schema (doesn't support extensions on complexContent)");
schema_extension_complexContent(sdl, tsn, content, cur_type);
return TRUE;
}
return TRUE; return TRUE;
} }
@ -768,12 +744,12 @@ static int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType,
attrs = compType->properties; attrs = compType->properties;
ns = get_attribute(attrs, "targetNamespace"); ns = get_attribute(attrs, "targetNamespace");
if(ns == NULL) if(ns == NULL) {
ns = tsn; ns = tsn;
}
name = get_attribute(attrs, "name"); name = get_attribute(attrs, "name");
if(name) if(name) {
{
HashTable *ht; HashTable *ht;
sdlTypePtr newType, *ptr; sdlTypePtr newType, *ptr;
smart_str key = {0}; smart_str key = {0};
@ -783,18 +759,14 @@ static int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType,
newType->name = strdup(name->children->content); newType->name = strdup(name->children->content);
newType->namens = strdup(ns->children->content); newType->namens = strdup(ns->children->content);
if(cur_type == NULL) if(cur_type == NULL) {
{
ht = (*sdl)->types; ht = (*sdl)->types;
smart_str_appends(&key, newType->namens); smart_str_appends(&key, newType->namens);
smart_str_appendc(&key, ':'); smart_str_appendc(&key, ':');
smart_str_appends(&key, newType->name); smart_str_appends(&key, newType->name);
smart_str_0(&key); smart_str_0(&key);
} } else {
else if(cur_type->elements == NULL) {
{
if(cur_type->elements == NULL)
{
cur_type->elements = malloc(sizeof(HashTable)); cur_type->elements = malloc(sizeof(HashTable));
zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1); zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
} }
@ -809,45 +781,44 @@ static int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType,
} }
content = get_node(compType->children, "simpleContent"); content = get_node(compType->children, "simpleContent");
if(content != NULL) if(content != NULL) {
{
schema_simpleContent(sdl, tsn, content, cur_type); schema_simpleContent(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(compType->children, "complexContent"); content = get_node(compType->children, "complexContent");
if(content != NULL) if(content != NULL) {
{
schema_complexContent(sdl, tsn, content, cur_type); schema_complexContent(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
/* (group | all | choice | sequence) */ /* (group | all | choice | sequence) */
content = get_node(compType->children, "group"); content = get_node(compType->children, "group");
if(content != NULL) if(content != NULL) {
{
schema_group(sdl, tsn, content, cur_type); schema_group(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(compType->children, "all"); content = get_node(compType->children, "all");
if(content != NULL) if(content != NULL) {
{
schema_all(sdl, tsn, content, cur_type); schema_all(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(compType->children, "choice"); content = get_node(compType->children, "choice");
if(content != NULL) if(content != NULL) {
{
schema_choice(sdl, tsn, content, cur_type); schema_choice(sdl, tsn, content, cur_type);
return TRUE; return TRUE;
} }
content = get_node(compType->children, "sequence"); content = get_node(compType->children, "sequence");
if(content != NULL) if(content != NULL) {
schema_sequence(sdl, tsn, content, cur_type); schema_sequence(sdl, tsn, content, cur_type);
}
// if (cur_type->encode == NULL) {
// cur_type->encode = get_conversion(SOAP_ENC_OBJECT);
// }
return TRUE; return TRUE;
} }
/* /*
@ -878,38 +849,36 @@ static int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTy
attrs = element->properties; attrs = element->properties;
ns = get_attribute(attrs, "targetNamespace"); ns = get_attribute(attrs, "targetNamespace");
if(ns == NULL) if(ns == NULL) {
ns = tsn; ns = tsn;
}
name = get_attribute(attrs, "name"); name = get_attribute(attrs, "name");
if(!name) if (!name) {
name = get_attribute(attrs, "ref"); name = get_attribute(attrs, "ref");
if(name) }
{
if(name) {
HashTable *addHash; HashTable *addHash;
sdlTypePtr newType, *tmp; sdlTypePtr newType, *tmp;
smart_str key = {0}; smart_str key = {0};
newType = malloc(sizeof(sdlType)); newType = malloc(sizeof(sdlType));
memset(newType, 0, sizeof(sdlType)); memset(newType, 0, sizeof(sdlType));
newType->name = strdup(name->children->content); newType->name = strdup(name->children->content);
newType->namens = strdup(tsn->children->content); newType->namens = strdup(tsn->children->content);
newType->nillable = FALSE; newType->nillable = FALSE;
newType->min_occurs = 1; newType->min_occurs = 1;
newType->max_occurs = 1; newType->max_occurs = 1;
if(cur_type == NULL) if(cur_type == NULL) {
{
addHash = (*sdl)->types; addHash = (*sdl)->types;
smart_str_appends(&key, newType->namens); smart_str_appends(&key, newType->namens);
smart_str_appendc(&key, ':'); smart_str_appendc(&key, ':');
smart_str_appends(&key, newType->name); smart_str_appends(&key, newType->name);
} } else {
else if(cur_type->elements == NULL) {
{
if(cur_type->elements == NULL)
{
cur_type->elements = malloc(sizeof(HashTable)); cur_type->elements = malloc(sizeof(HashTable));
zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1); zend_hash_init(cur_type->elements, 0, NULL, delete_type, 1);
} }
@ -925,38 +894,39 @@ static int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTy
} }
curattr = get_attribute(attrs, "maxOccurs"); curattr = get_attribute(attrs, "maxOccurs");
if(curattr) if(curattr) {
{ if(!strcmp(curattr->children->content, "unbounded")) {
if(!strcmp(curattr->children->content, "unbounded"))
cur_type->max_occurs = -1; cur_type->max_occurs = -1;
else } else {
cur_type->max_occurs = atoi(curattr->children->content); cur_type->max_occurs = atoi(curattr->children->content);
} }
}
curattr = get_attribute(attrs, "minOccurs"); curattr = get_attribute(attrs, "minOccurs");
if(curattr) if(curattr) {
cur_type->min_occurs = atoi(curattr->children->content); cur_type->min_occurs = atoi(curattr->children->content);
}
/* nillable = boolean : false */ /* nillable = boolean : false */
attrs = element->properties; attrs = element->properties;
curattr = get_attribute(attrs, "nillable"); curattr = get_attribute(attrs, "nillable");
if(curattr) if(curattr) {
{
if(!stricmp(curattr->children->content, "true") || if(!stricmp(curattr->children->content, "true") ||
!stricmp(curattr->children->content, "1")) !stricmp(curattr->children->content, "1")) {
cur_type->nillable = TRUE; cur_type->nillable = TRUE;
else } else {
cur_type->nillable = FALSE; cur_type->nillable = FALSE;
} }
else } else {
cur_type->nillable = FALSE; cur_type->nillable = FALSE;
}
/* type = QName */ /* type = QName */
curattr = get_attribute(attrs, "type"); curattr = get_attribute(attrs, "type");
if(!curattr) if(!curattr) {
curattr = name; curattr = name;
if(curattr) }
{ if(curattr) {
char *cptype, *str_ns; char *cptype, *str_ns;
xmlNsPtr nsptr; xmlNsPtr nsptr;
@ -967,20 +937,22 @@ static int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTy
// nsptr = xmlSearchNsByHref(element->doc, element, ns->children->content); // nsptr = xmlSearchNsByHref(element->doc, element, ns->children->content);
cur_type->encode = get_create_encoder((*sdl), cur_type, (char *)nsptr->href, (char *)cptype); cur_type->encode = get_create_encoder((*sdl), cur_type, (char *)nsptr->href, (char *)cptype);
if(str_ns) efree(str_ns); if(str_ns) {efree(str_ns);}
if(cptype) efree(cptype); if(cptype) {efree(cptype);}
} }
if(cur_type->max_occurs == -1 || cur_type->max_occurs > 1) // if(cur_type->max_occurs == -1 || cur_type->max_occurs > 1)
cur_type->encode = get_conversion(SOAP_ENC_ARRAY); // cur_type->encode = get_conversion(SOAP_ENC_ARRAY);
content = get_node(element->children, "simpleType"); content = get_node(element->children, "simpleType");
if(content) if(content) {
schema_simpleType(sdl, tsn, content, cur_type); schema_simpleType(sdl, tsn, content, cur_type);
}
content = get_node(element->children, "complexType"); content = get_node(element->children, "complexType");
if(content) if(content) {
schema_complexType(sdl, tsn, content, cur_type); schema_complexType(sdl, tsn, content, cur_type);
}
return FALSE; return FALSE;
} }
@ -1009,41 +981,36 @@ static int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sd
newAttr = malloc(sizeof(sdlAttribute)); newAttr = malloc(sizeof(sdlAttribute));
memset(newAttr, 0, sizeof(sdlAttribute)); memset(newAttr, 0, sizeof(sdlAttribute));
if(cur_type->attributes == NULL) if(cur_type->attributes == NULL) {
{
cur_type->attributes = malloc(sizeof(HashTable)); cur_type->attributes = malloc(sizeof(HashTable));
zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, 1); zend_hash_init(cur_type->attributes, 0, NULL, delete_attribute, 1);
} }
trav = attrType->properties; trav = attrType->properties;
FOREACHATTRNODE(trav, NULL, attr) FOREACHATTRNODE(trav, NULL, attr) {
{ if(attr_is_equal_ex(trav, "default", SCHEMA_NAMESPACE)) {
if(attr_is_equal_ex(trav, "default", SCHEMA_NAMESPACE))
newAttr->def = strdup(attr->children->content); newAttr->def = strdup(attr->children->content);
else if(attr_is_equal_ex(trav, "fixed", SCHEMA_NAMESPACE)) } else if(attr_is_equal_ex(trav, "fixed", SCHEMA_NAMESPACE)) {
newAttr->fixed = strdup(attr->children->content); newAttr->fixed = strdup(attr->children->content);
else if(attr_is_equal_ex(trav, "form", SCHEMA_NAMESPACE)) } else if(attr_is_equal_ex(trav, "form", SCHEMA_NAMESPACE)) {
newAttr->form = strdup(attr->children->content); newAttr->form = strdup(attr->children->content);
else if(attr_is_equal_ex(trav, "id", SCHEMA_NAMESPACE)) } else if(attr_is_equal_ex(trav, "id", SCHEMA_NAMESPACE)) {
newAttr->id = strdup(attr->children->content); newAttr->id = strdup(attr->children->content);
else if(attr_is_equal_ex(trav, "name", SCHEMA_NAMESPACE)) } else if(attr_is_equal_ex(trav, "name", SCHEMA_NAMESPACE)) {
newAttr->name = strdup(attr->children->content); newAttr->name = strdup(attr->children->content);
else if(attr_is_equal_ex(trav, "ref", SCHEMA_NAMESPACE)) } else if(attr_is_equal_ex(trav, "ref", SCHEMA_NAMESPACE)) {
newAttr->ref= strdup(attr->children->content); newAttr->ref= strdup(attr->children->content);
else if(attr_is_equal_ex(trav, "type", SCHEMA_NAMESPACE)) } else if(attr_is_equal_ex(trav, "type", SCHEMA_NAMESPACE)) {
newAttr->type = strdup(attr->children->content); newAttr->type = strdup(attr->children->content);
else if(attr_is_equal_ex(trav, "use", SCHEMA_NAMESPACE)) } else if(attr_is_equal_ex(trav, "use", SCHEMA_NAMESPACE)) {
newAttr->use = strdup(attr->children->content); newAttr->use = strdup(attr->children->content);
else } else {
{
xmlNsPtr nsPtr = attr_find_ns(trav); xmlNsPtr nsPtr = attr_find_ns(trav);
if(strcmp(nsPtr->href, SCHEMA_NAMESPACE)) if(strcmp(nsPtr->href, SCHEMA_NAMESPACE)) {
{
smart_str key2 = {0}; smart_str key2 = {0};
if(!newAttr->extraAttributes) if(!newAttr->extraAttributes) {
{
newAttr->extraAttributes = malloc(sizeof(HashTable)); newAttr->extraAttributes = malloc(sizeof(HashTable));
zend_hash_init(newAttr->extraAttributes, 0, NULL, NULL, 1); zend_hash_init(newAttr->extraAttributes, 0, NULL, NULL, 1);
} }
@ -1060,12 +1027,10 @@ static int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sd
ENDFOREACH(trav); ENDFOREACH(trav);
if(newAttr->ref || newAttr->name) if(newAttr->ref || newAttr->name) {
{
xmlNsPtr ns; xmlNsPtr ns;
if(newAttr->ref) if(newAttr->ref) {
{
char *value, *prefix = NULL; char *value, *prefix = NULL;
parse_namespace(newAttr->ref, &value, &prefix); parse_namespace(newAttr->ref, &value, &prefix);
@ -1074,22 +1039,16 @@ static int schema_attribute(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sd
smart_str_appendc(&key, ':'); smart_str_appendc(&key, ':');
smart_str_appends(&key, value); smart_str_appends(&key, value);
if(value) if(value) {efree(value);}
efree(value); if(prefix) {efree(prefix);}
if(prefix) } else {
efree(prefix);
}
else
{
ns = node_find_ns(attrType); ns = node_find_ns(attrType);
smart_str_appends(&key, ns->href); smart_str_appends(&key, ns->href);
smart_str_appendc(&key, ':'); smart_str_appendc(&key, ':');
smart_str_appends(&key, newAttr->name); smart_str_appends(&key, newAttr->name);
} }
if(ns) {
if(ns)
{
smart_str_0(&key); smart_str_0(&key);
zend_hash_add(cur_type->attributes, key.c, key.len + 1, &newAttr, sizeof(sdlAttributePtr), NULL); zend_hash_add(cur_type->attributes, key.c, key.len + 1, &newAttr, sizeof(sdlAttributePtr), NULL);
smart_str_free(&key); smart_str_free(&key);

View file

@ -3,4 +3,7 @@
int load_schema(sdlPtr *sdl,xmlNodePtr schema); int load_schema(sdlPtr *sdl,xmlNodePtr schema);
void delete_restriction_var_int(void *rvi);
void delete_schema_restriction_var_char(void *srvc);
#endif #endif

View file

@ -98,16 +98,19 @@ zval *sdl_guess_convert_zval(encodeType enc, xmlNodePtr data)
type = enc.sdl_type; type = enc.sdl_type;
if(type->encode) { if(type->encode) {
if(type->encode->details.type == IS_ARRAY || // if(type->encode->details.type == IS_ARRAY ||
type->encode->details.type == SOAP_ENC_ARRAY) { // type->encode->details.type == SOAP_ENC_ARRAY) {
return to_zval_array(enc, data); // return to_zval_array(enc, data);
} else { // } 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) { if (memcmp(&type->encode->details,&enc,sizeof(enc))!=0) {
return master_to_zval(type->encode, data); return master_to_zval(type->encode, data);
} else { } else {
return master_to_zval(get_conversion(UNKNOWN_TYPE), data); return master_to_zval(get_conversion(UNKNOWN_TYPE), data);
} }
} // }
} else if (type->elements) { } else if (type->elements) {
return to_zval_object(enc, data); return to_zval_object(enc, data);
} else { } else {
@ -122,10 +125,23 @@ xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval *data, int style)
type = enc.sdl_type; 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) {
if(type->encode->details.type == IS_ARRAY || if (type->encode->details.type == IS_ARRAY ||
type->encode->details.type == SOAP_ENC_ARRAY) { type->encode->details.type == SOAP_ENC_ARRAY) {
ret = sdl_to_xml_array(type, data, style); 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 { } else {
if (memcmp(&type->encode->details,&enc,sizeof(enc))!=0) { if (memcmp(&type->encode->details,&enc,sizeof(enc))!=0) {
ret = master_to_xml(type->encode, data, style); ret = master_to_xml(type->encode, data, style);
@ -612,6 +628,8 @@ sdlPtr load_wsdl(char *struri, sdlPtr parent)
else else
tmpsdl = parent; tmpsdl = parent;
/* TODO: WSDL Caching */
wsdl = xmlParseFile(struri); wsdl = xmlParseFile(struri);
xmlCleanupParser(); xmlCleanupParser();
@ -1174,8 +1192,10 @@ void delete_type(void *data)
delete_restriction_var_int(&type->restrictions->maxLength); delete_restriction_var_int(&type->restrictions->maxLength);
delete_schema_restriction_var_char(&type->restrictions->whiteSpace); delete_schema_restriction_var_char(&type->restrictions->whiteSpace);
delete_schema_restriction_var_char(&type->restrictions->pattern); delete_schema_restriction_var_char(&type->restrictions->pattern);
if (type->restrictions->enumeration) {
zend_hash_destroy(type->restrictions->enumeration); zend_hash_destroy(type->restrictions->enumeration);
free(type->restrictions->enumeration); free(type->restrictions->enumeration);
}
free(type->restrictions); free(type->restrictions);
} }
free(type); free(type);

View file

@ -1278,7 +1278,7 @@ void soap_error_handler(int error_num, const char *error_filename, const uint er
zval_dtor(&outbuf); zval_dtor(&outbuf);
zval_dtor(&outbuflen); zval_dtor(&outbuflen);
zval_dtor(&ret); // zval_dtor(&ret);
zend_bailout(); zend_bailout();
} }
@ -1472,6 +1472,11 @@ zend_try {
} else { } else {
*return_value = *add_soap_fault(thisObj, "SOAP-ENV:Client", "Unknown Error", NULL, NULL TSRMLS_CC); *return_value = *add_soap_fault(thisObj, "SOAP-ENV:Client", "Unknown Error", NULL, NULL TSRMLS_CC);
} }
} else {
zval** fault;
if(zend_hash_find(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == SUCCESS) {
*return_value = **fault;
}
} }
SOAP_GLOBAL(sdl) = NULL; SOAP_GLOBAL(sdl) = NULL;
} }
@ -1669,6 +1674,9 @@ zval* add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *faul
zval *fault; zval *fault;
MAKE_STD_ZVAL(fault); MAKE_STD_ZVAL(fault);
set_soap_fault(fault, fault_string, fault_code, fault_actor, fault_detail TSRMLS_CC); set_soap_fault(fault, fault_string, fault_code, fault_actor, fault_detail TSRMLS_CC);
#ifdef ZEND_ENGINE_2
fault->refcount--;
#endif
add_property_zval(obj, "__soap_fault", fault); add_property_zval(obj, "__soap_fault", fault);
return fault; return fault;
} }
@ -1689,8 +1697,8 @@ void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault
if(fault_detail != NULL) if(fault_detail != NULL)
{ {
#ifndef ZEND_ENGINE_2 #ifdef ZEND_ENGINE_2
zval_add_ref(&fault_detail); fault_detail->refcount--;
#endif #endif
add_property_zval(obj, "detail", fault_detail); add_property_zval(obj, "detail", fault_detail);
} }