mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Error reoprting improved by prefix
New 'HTTP' fault code Source cleanup
This commit is contained in:
parent
01c6257c5c
commit
6cf3c8586e
12 changed files with 271 additions and 342 deletions
|
@ -254,6 +254,10 @@ class Interop_Client
|
||||||
$error = '';
|
$error = '';
|
||||||
} else {
|
} else {
|
||||||
$success = $result['fault']->faultcode;
|
$success = $result['fault']->faultcode;
|
||||||
|
$pos = strpos($success,':');
|
||||||
|
if ($pos !== false) {
|
||||||
|
$success = substr($success,$pos+1);
|
||||||
|
}
|
||||||
$error = $result['fault']->faultstring;
|
$error = $result['fault']->faultstring;
|
||||||
if (!$wire) $wire= $result['fault']->detail;
|
if (!$wire) $wire= $result['fault']->detail;
|
||||||
}
|
}
|
||||||
|
@ -529,10 +533,15 @@ class Interop_Client
|
||||||
} else {
|
} else {
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$res =$fault->faultcode;
|
$res =$fault->faultcode;
|
||||||
|
$pos = strpos($res,':');
|
||||||
|
if ($pos !== false) {
|
||||||
|
$res = substr($res,$pos+1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// save the wire
|
// save the wire
|
||||||
$wire = "REQUEST:\n".str_replace('" ',"\" \n",str_replace('>',">\n",$soap->__getlastrequest()))."\n\n".
|
$wire = "REQUEST:\n".str_replace('" ',"\" \n",str_replace('>',">\n",$soap->__getlastrequest()))."\n\n".
|
||||||
"RESPONSE:\n".str_replace('" ',"\" \n",str_replace('>',">\n",$soap->__getlastresponse()));
|
"RESPONSE:\n".str_replace('" ',"\" \n",str_replace('>',">\n",$soap->__getlastresponse()))."\n".
|
||||||
|
"RESULTL:\n".var_dump_str($return);
|
||||||
#print "Wire:".htmlentities($wire);
|
#print "Wire:".htmlentities($wire);
|
||||||
|
|
||||||
$soap_test->setResult($ok,$res, $wire,$fault->faultstring, $fault);
|
$soap_test->setResult($ok,$res, $wire,$fault->faultstring, $fault);
|
||||||
|
|
|
@ -115,7 +115,12 @@ class SOAP_Test {
|
||||||
} else {
|
} else {
|
||||||
$fault = $this->result['fault'];
|
$fault = $this->result['fault'];
|
||||||
if ($fault) {
|
if ($fault) {
|
||||||
print "<font color=\"#ff0000\">FAILED: {$fault->faultcode} {$fault->faultstring}</font>\n";
|
$res = $fault->faultcode;
|
||||||
|
$pos = strpos($res,':');
|
||||||
|
if ($pos !== false) {
|
||||||
|
$res = substr($res,$pos+1);
|
||||||
|
}
|
||||||
|
print "<font color=\"#ff0000\">FAILED: [$res] {$fault->faultstring}</font>\n";
|
||||||
} else {
|
} else {
|
||||||
print "<font color=\"#ff0000\">FAILED: ".$this->result['result']."</font>\n";
|
print "<font color=\"#ff0000\">FAILED: ".$this->result['result']."</font>\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,8 @@ static xmlNodePtr guess_xml_convert(encodeTypePtr type, zval *data, int style, x
|
||||||
static int is_map(zval *array);
|
static int is_map(zval *array);
|
||||||
static void get_array_type(xmlNodePtr node, zval *array, smart_str *out_type TSRMLS_DC);
|
static void get_array_type(xmlNodePtr node, zval *array, smart_str *out_type TSRMLS_DC);
|
||||||
|
|
||||||
|
static xmlNodePtr check_and_resolve_href(xmlNodePtr data);
|
||||||
|
|
||||||
static void get_type_str(xmlNodePtr node, const char* ns, const char* type, smart_str* ret);
|
static void get_type_str(xmlNodePtr node, const char* ns, const char* type, smart_str* ret);
|
||||||
static void set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type);
|
static void set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type);
|
||||||
|
|
||||||
|
@ -263,7 +265,7 @@ zval *to_xml_before_user(encodeTypePtr type, zval *data)
|
||||||
|
|
||||||
if (type.map->map_functions.to_xml_before) {
|
if (type.map->map_functions.to_xml_before) {
|
||||||
if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml_before, data, 1, &data TSRMLS_CC) == FAILURE) {
|
if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml_before, data, 1, &data TSRMLS_CC) == FAILURE) {
|
||||||
php_error(E_ERROR, "Error calling to_xml_before");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_xml_before");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
|
@ -278,11 +280,11 @@ xmlNodePtr to_xml_user(encodeTypePtr type, zval *data, int style, xmlNodePtr par
|
||||||
if (type.map->map_functions.to_xml) {
|
if (type.map->map_functions.to_xml) {
|
||||||
MAKE_STD_ZVAL(ret);
|
MAKE_STD_ZVAL(ret);
|
||||||
if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml, ret, 1, &data TSRMLS_CC) == FAILURE) {
|
if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml, ret, 1, &data TSRMLS_CC) == FAILURE) {
|
||||||
php_error(E_ERROR, "Error calling to_xml");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Z_TYPE_P(ret) != IS_OBJECT) {
|
if (Z_TYPE_P(ret) != IS_OBJECT) {
|
||||||
php_error(E_ERROR, "Error serializing object from to_xml_user");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: Error serializing object from to_xml_user");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS) {
|
if (zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS) {
|
||||||
|
@ -307,7 +309,7 @@ xmlNodePtr to_xml_after_user(encodeTypePtr type, xmlNodePtr node, int style)
|
||||||
param = php_domobject_new(node, &found, NULL TSRMLS_CC);
|
param = php_domobject_new(node, &found, NULL TSRMLS_CC);
|
||||||
|
|
||||||
if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml_after, ret, 1, ¶m TSRMLS_CC) == FAILURE) {
|
if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml_after, ret, 1, ¶m TSRMLS_CC) == FAILURE) {
|
||||||
php_error(E_ERROR, "Error calling to_xml_after");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_xml_after");
|
||||||
}
|
}
|
||||||
if (zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS) {
|
if (zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS) {
|
||||||
node = (xmlNodePtr)Z_LVAL_PP(addr);
|
node = (xmlNodePtr)Z_LVAL_PP(addr);
|
||||||
|
@ -331,7 +333,7 @@ xmlNodePtr to_zval_before_user(encodeTypePtr type, xmlNodePtr node, int style)
|
||||||
param = php_domobject_new(node, &found, NULL TSRMLS_CC);
|
param = php_domobject_new(node, &found, NULL TSRMLS_CC);
|
||||||
|
|
||||||
if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval_before, ret, 1, ¶m TSRMLS_CC) == FAILURE) {
|
if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval_before, ret, 1, ¶m TSRMLS_CC) == FAILURE) {
|
||||||
php_error(E_ERROR, "Error calling to_zval_before");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_zval_before");
|
||||||
}
|
}
|
||||||
if (zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS) {
|
if (zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS) {
|
||||||
node = (xmlNodePtr)Z_LVAL_PP(addr);
|
node = (xmlNodePtr)Z_LVAL_PP(addr);
|
||||||
|
@ -355,7 +357,7 @@ zval *to_zval_user(encodeTypePtr type, xmlNodePtr node)
|
||||||
param = php_domobject_new(node, &found, NULL TSRMLS_CC);
|
param = php_domobject_new(node, &found, NULL TSRMLS_CC);
|
||||||
|
|
||||||
if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval, ret, 1, ¶m TSRMLS_CC) == FAILURE) {
|
if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval, ret, 1, ¶m TSRMLS_CC) == FAILURE) {
|
||||||
php_error(E_ERROR, "Error calling to_zval");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_zval");
|
||||||
}
|
}
|
||||||
zval_ptr_dtor(¶m);
|
zval_ptr_dtor(¶m);
|
||||||
efree(param);
|
efree(param);
|
||||||
|
@ -369,7 +371,7 @@ zval *to_zval_after_user(encodeTypePtr type, zval *data)
|
||||||
|
|
||||||
if (type.map->map_functions.to_zval_after) {
|
if (type.map->map_functions.to_zval_after) {
|
||||||
if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval_after, data, 1, &data TSRMLS_CC) == FAILURE) {
|
if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval_after, data, 1, &data TSRMLS_CC) == FAILURE) {
|
||||||
php_error(E_ERROR, "Error calling to_xml_before");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_zval_after");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
|
@ -387,7 +389,7 @@ static zval *to_zval_string(encodeTypePtr type, xmlNodePtr data)
|
||||||
if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
|
if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
|
||||||
ZVAL_STRING(ret, data->children->content, 1);
|
ZVAL_STRING(ret, data->children->content, 1);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Violation of encoding rules");
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ZVAL_EMPTY_STRING(ret);
|
ZVAL_EMPTY_STRING(ret);
|
||||||
|
@ -405,7 +407,7 @@ static zval *to_zval_stringr(encodeTypePtr type, xmlNodePtr data)
|
||||||
whiteSpace_replace(data->children->content);
|
whiteSpace_replace(data->children->content);
|
||||||
ZVAL_STRING(ret, data->children->content, 1);
|
ZVAL_STRING(ret, data->children->content, 1);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Violation of encoding rules");
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ZVAL_EMPTY_STRING(ret);
|
ZVAL_EMPTY_STRING(ret);
|
||||||
|
@ -423,7 +425,7 @@ static zval *to_zval_stringc(encodeTypePtr type, xmlNodePtr data)
|
||||||
whiteSpace_collapse(data->children->content);
|
whiteSpace_collapse(data->children->content);
|
||||||
ZVAL_STRING(ret, data->children->content, 1);
|
ZVAL_STRING(ret, data->children->content, 1);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Violation of encoding rules");
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ZVAL_EMPTY_STRING(ret);
|
ZVAL_EMPTY_STRING(ret);
|
||||||
|
@ -498,7 +500,7 @@ static zval *to_zval_double(encodeTypePtr type, xmlNodePtr data)
|
||||||
whiteSpace_collapse(data->children->content);
|
whiteSpace_collapse(data->children->content);
|
||||||
ZVAL_DOUBLE(ret, atof(data->children->content));
|
ZVAL_DOUBLE(ret, atof(data->children->content));
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Violation of encoding rules");
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ZVAL_NULL(ret);
|
ZVAL_NULL(ret);
|
||||||
|
@ -517,7 +519,7 @@ static zval *to_zval_long(encodeTypePtr type, xmlNodePtr data)
|
||||||
whiteSpace_collapse(data->children->content);
|
whiteSpace_collapse(data->children->content);
|
||||||
ZVAL_LONG(ret, atol(data->children->content));
|
ZVAL_LONG(ret, atol(data->children->content));
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Violation of encoding rules");
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ZVAL_NULL(ret);
|
ZVAL_NULL(ret);
|
||||||
|
@ -543,7 +545,7 @@ static zval *to_zval_ulong(encodeTypePtr type, xmlNodePtr data)
|
||||||
ret->type = IS_LONG;
|
ret->type = IS_LONG;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Violation of encoding rules");
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ZVAL_NULL(ret);
|
ZVAL_NULL(ret);
|
||||||
|
@ -646,7 +648,7 @@ static zval *to_zval_bool(encodeTypePtr type, xmlNodePtr data)
|
||||||
ZVAL_BOOL(ret, 0);
|
ZVAL_BOOL(ret, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Violation of encoding rules");
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ZVAL_NULL(ret);
|
ZVAL_NULL(ret);
|
||||||
|
@ -849,7 +851,7 @@ static zval *to_zval_object(encodeTypePtr type, xmlNodePtr data)
|
||||||
if (val && val->children && val->children->content) {
|
if (val && val->children && val->children->content) {
|
||||||
str_val = val->children->content;
|
str_val = val->children->content;
|
||||||
if ((*attr)->fixed && strcmp((*attr)->fixed,str_val) != 0) {
|
if ((*attr)->fixed && strcmp((*attr)->fixed,str_val) != 0) {
|
||||||
php_error(E_ERROR,"Attribute '%s' has fixed value '%s' (value '%s' is not allowed)",(*attr)->name,(*attr)->fixed,str_val);
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Attribute '%s' has fixed value '%s' (value '%s' is not allowed)",(*attr)->name,(*attr)->fixed,str_val);
|
||||||
}
|
}
|
||||||
} else if ((*attr)->def) {
|
} else if ((*attr)->def) {
|
||||||
str_val = (*attr)->def;
|
str_val = (*attr)->def;
|
||||||
|
@ -929,7 +931,7 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, HashTa
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
if (strict) {
|
if (strict) {
|
||||||
php_error(E_ERROR, "object hasn't '%s' property",model->u.element->name);
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: object hasn't '%s' property",model->u.element->name);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -985,7 +987,7 @@ static xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style, xmlNo
|
||||||
encodePtr enc;
|
encodePtr enc;
|
||||||
|
|
||||||
if (zend_hash_find(Z_OBJPROP_P(data), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE) {
|
if (zend_hash_find(Z_OBJPROP_P(data), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE) {
|
||||||
php_error(E_ERROR, "error encoding SoapVar");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: SoapVar hasn't 'enc_type' propery");
|
||||||
}
|
}
|
||||||
|
|
||||||
enc = get_conversion(Z_LVAL_P(*ztype));
|
enc = get_conversion(Z_LVAL_P(*ztype));
|
||||||
|
@ -1085,7 +1087,7 @@ static xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style, xmlNo
|
||||||
dummy = master_to_xml((*attr)->encode, *data, SOAP_LITERAL, xmlParam);
|
dummy = master_to_xml((*attr)->encode, *data, SOAP_LITERAL, xmlParam);
|
||||||
if (dummy->children && dummy->children->content) {
|
if (dummy->children && dummy->children->content) {
|
||||||
if ((*attr)->fixed && strcmp((*attr)->fixed,dummy->children->content) != 0) {
|
if ((*attr)->fixed && strcmp((*attr)->fixed,dummy->children->content) != 0) {
|
||||||
php_error(E_ERROR,"Attribute '%s' has fixed value '%s' (value '%s' is not allowed)",(*attr)->name,(*attr)->fixed,dummy->children->content);
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Attribute '%s' has fixed value '%s' (value '%s' is not allowed)",(*attr)->name,(*attr)->fixed,dummy->children->content);
|
||||||
}
|
}
|
||||||
xmlSetProp(xmlParam, (*attr)->name, dummy->children->content);
|
xmlSetProp(xmlParam, (*attr)->name, dummy->children->content);
|
||||||
}
|
}
|
||||||
|
@ -1173,7 +1175,7 @@ static int calc_dimension_12(const char* str)
|
||||||
flag = 1;
|
flag = 1;
|
||||||
}
|
}
|
||||||
} else if (*str == '*') {
|
} else if (*str == '*') {
|
||||||
php_error(E_ERROR,"* may only be first arraySize value in list");
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: '*' may only be first arraySize value in list");
|
||||||
} else {
|
} else {
|
||||||
flag = 0;
|
flag = 0;
|
||||||
}
|
}
|
||||||
|
@ -1204,7 +1206,7 @@ static int* get_position_12(int dimension, const char* str)
|
||||||
}
|
}
|
||||||
pos[i] = (pos[i]*10)+(*str-'0');
|
pos[i] = (pos[i]*10)+(*str-'0');
|
||||||
} else if (*str == '*') {
|
} else if (*str == '*') {
|
||||||
php_error(E_ERROR,"* may only be first arraySize value in list");
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: '*' may only be first arraySize value in list");
|
||||||
} else {
|
} else {
|
||||||
flag = 0;
|
flag = 0;
|
||||||
}
|
}
|
||||||
|
@ -1854,12 +1856,12 @@ static zval *to_zval_map(encodeTypePtr type, xmlNodePtr data)
|
||||||
FOREACHNODE(trav, "item", item) {
|
FOREACHNODE(trav, "item", item) {
|
||||||
xmlKey = get_node(item->children, "key");
|
xmlKey = get_node(item->children, "key");
|
||||||
if (!xmlKey) {
|
if (!xmlKey) {
|
||||||
php_error(E_ERROR, "Error encoding apache map, missing key");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: Can't decode apache map, missing key");
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlValue = get_node(item->children, "value");
|
xmlValue = get_node(item->children, "value");
|
||||||
if (!xmlKey) {
|
if (!xmlKey) {
|
||||||
php_error(E_ERROR, "Error encoding apache map, missing value");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: Can't decode apache map, missing value");
|
||||||
}
|
}
|
||||||
|
|
||||||
key = master_to_zval(enc, xmlKey);
|
key = master_to_zval(enc, xmlKey);
|
||||||
|
@ -1870,7 +1872,7 @@ static zval *to_zval_map(encodeTypePtr type, xmlNodePtr data)
|
||||||
} else if (Z_TYPE_P(key) == IS_LONG) {
|
} else if (Z_TYPE_P(key) == IS_LONG) {
|
||||||
zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL_P(key), &value, sizeof(zval *), NULL);
|
zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL_P(key), &value, sizeof(zval *), NULL);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error encoding apache map, only Strings or Longs are allowd as keys");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: Can't decode apache map, only Strings or Longs are allowd as keys");
|
||||||
}
|
}
|
||||||
zval_ptr_dtor(&key);
|
zval_ptr_dtor(&key);
|
||||||
}
|
}
|
||||||
|
@ -1915,10 +1917,6 @@ static zval *guess_zval_convert(encodeTypePtr type, xmlNodePtr data)
|
||||||
} else {
|
} else {
|
||||||
enc = get_conversion_from_type(data, "");
|
enc = get_conversion_from_type(data, "");
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (enc == NULL)
|
|
||||||
php_error(E_ERROR, "Error (Don't know how to encode/decode \"%s\")", tmpattr->children->content);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enc == NULL) {
|
if (enc == NULL) {
|
||||||
|
@ -2086,7 +2084,7 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP
|
||||||
}
|
}
|
||||||
smart_str_appends(&list, dummy->children->content);
|
smart_str_appends(&list, dummy->children->content);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Violation of encoding rules");
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
|
||||||
}
|
}
|
||||||
xmlUnlinkNode(dummy);
|
xmlUnlinkNode(dummy);
|
||||||
xmlFreeNode(dummy);
|
xmlFreeNode(dummy);
|
||||||
|
@ -2125,7 +2123,7 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP
|
||||||
}
|
}
|
||||||
smart_str_appends(&list, dummy->children->content);
|
smart_str_appends(&list, dummy->children->content);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Violation of encoding rules");
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
|
||||||
}
|
}
|
||||||
xmlUnlinkNode(dummy);
|
xmlUnlinkNode(dummy);
|
||||||
xmlFreeNode(dummy);
|
xmlFreeNode(dummy);
|
||||||
|
@ -2173,20 +2171,20 @@ zval *sdl_guess_convert_zval(encodeTypePtr enc, xmlNodePtr data)
|
||||||
}
|
}
|
||||||
if (type->restrictions->enumeration) {
|
if (type->restrictions->enumeration) {
|
||||||
if (!zend_hash_exists(type->restrictions->enumeration,data->children->content,strlen(data->children->content)+1)) {
|
if (!zend_hash_exists(type->restrictions->enumeration,data->children->content,strlen(data->children->content)+1)) {
|
||||||
php_error(E_WARNING,"Restriction: invalid enumeration value \"%s\"",data->children->content);
|
php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: invalid enumeration value \"%s\"",data->children->content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type->restrictions->minLength &&
|
if (type->restrictions->minLength &&
|
||||||
strlen(data->children->content) < type->restrictions->minLength->value) {
|
strlen(data->children->content) < type->restrictions->minLength->value) {
|
||||||
php_error(E_WARNING,"Restriction: length less then 'minLength'");
|
php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: length less then 'minLength'");
|
||||||
}
|
}
|
||||||
if (type->restrictions->maxLength &&
|
if (type->restrictions->maxLength &&
|
||||||
strlen(data->children->content) > type->restrictions->maxLength->value) {
|
strlen(data->children->content) > type->restrictions->maxLength->value) {
|
||||||
php_error(E_WARNING,"Restriction: length greater then 'maxLength'");
|
php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: length greater then 'maxLength'");
|
||||||
}
|
}
|
||||||
if (type->restrictions->length &&
|
if (type->restrictions->length &&
|
||||||
strlen(data->children->content) != type->restrictions->length->value) {
|
strlen(data->children->content) != type->restrictions->length->value) {
|
||||||
php_error(E_WARNING,"Restriction: length is not equal to 'length'");
|
php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: length is not equal to 'length'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -2227,20 +2225,20 @@ xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNo
|
||||||
if (type->restrictions && Z_TYPE_P(data) == IS_STRING) {
|
if (type->restrictions && Z_TYPE_P(data) == IS_STRING) {
|
||||||
if (type->restrictions->enumeration) {
|
if (type->restrictions->enumeration) {
|
||||||
if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRLEN_P(data)+1)) {
|
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));
|
php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: invalid enumeration value \"%s\".",Z_STRVAL_P(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type->restrictions->minLength &&
|
if (type->restrictions->minLength &&
|
||||||
Z_STRLEN_P(data) < type->restrictions->minLength->value) {
|
Z_STRLEN_P(data) < type->restrictions->minLength->value) {
|
||||||
php_error(E_WARNING,"Restriction: length less then 'minLength'");
|
php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: length less then 'minLength'");
|
||||||
}
|
}
|
||||||
if (type->restrictions->maxLength &&
|
if (type->restrictions->maxLength &&
|
||||||
Z_STRLEN_P(data) > type->restrictions->maxLength->value) {
|
Z_STRLEN_P(data) > type->restrictions->maxLength->value) {
|
||||||
php_error(E_WARNING,"Restriction: length greater then 'maxLength'");
|
php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: length greater then 'maxLength'");
|
||||||
}
|
}
|
||||||
if (type->restrictions->length &&
|
if (type->restrictions->length &&
|
||||||
Z_STRLEN_P(data) != type->restrictions->length->value) {
|
Z_STRLEN_P(data) != type->restrictions->length->value) {
|
||||||
php_error(E_WARNING,"Restriction: length is not equal to 'length'");
|
php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: length is not equal to 'length'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2280,6 +2278,44 @@ xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNo
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static xmlNodePtr check_and_resolve_href(xmlNodePtr data)
|
||||||
|
{
|
||||||
|
if (data && data->properties) {
|
||||||
|
xmlAttrPtr href = get_attribute(data->properties, "href");
|
||||||
|
if (href) {
|
||||||
|
/* Internal href try and find node */
|
||||||
|
if (href->children->content[0] == '#') {
|
||||||
|
xmlNodePtr ret = get_node_with_attribute_recursive(data->doc->children, NULL, "id", &href->children->content[1]);
|
||||||
|
if (!ret) {
|
||||||
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Unresolved reference '%s'",href->children->content);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
} else {
|
||||||
|
/* TODO: External href....? */
|
||||||
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: External reference '%s'",href->children->content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* SOAP 1.2 enc:id enc:ref */
|
||||||
|
href = get_attribute_ex(data->properties, "ref", SOAP_1_2_ENC_NAMESPACE);
|
||||||
|
if (href) {
|
||||||
|
/* Internal href try and find node */
|
||||||
|
if (href->children->content[0] == '#') {
|
||||||
|
xmlNodePtr ret = get_node_with_attribute_recursive_ex(data->doc->children, NULL, NULL, "id", &href->children->content[1], SOAP_1_2_ENC_NAMESPACE);
|
||||||
|
if (!ret) {
|
||||||
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Unresolved reference '%s'",href->children->content);
|
||||||
|
} else if (ret == data) {
|
||||||
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of id and ref information items '%s'",href->children->content);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
} else {
|
||||||
|
/* TODO: External href....? */
|
||||||
|
php_error(E_ERROR,"SOAP-ERROR: Encoding: External reference '%s'",href->children->content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
static void set_ns_and_type(xmlNodePtr node, encodeTypePtr type)
|
static void set_ns_and_type(xmlNodePtr node, encodeTypePtr type)
|
||||||
{
|
{
|
||||||
set_ns_and_type_ex(node, type->ns, type->type_str);
|
set_ns_and_type_ex(node, type->ns, type->type_str);
|
||||||
|
@ -2334,7 +2370,7 @@ encodePtr get_conversion_ex(HashTable *encoding, int encode)
|
||||||
TSRMLS_FETCH();
|
TSRMLS_FETCH();
|
||||||
|
|
||||||
if (zend_hash_index_find(encoding, encode, (void **)&enc) == FAILURE) {
|
if (zend_hash_index_find(encoding, encode, (void **)&enc) == FAILURE) {
|
||||||
php_error(E_ERROR, "Cannot find encoding");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: Cannot find encoding");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SOAP_GLOBAL(overrides)) {
|
if (SOAP_GLOBAL(overrides)) {
|
||||||
|
@ -2444,7 +2480,7 @@ static void get_array_type(xmlNodePtr node, zval *array, smart_str *type TSRMLS_
|
||||||
zval **ztype;
|
zval **ztype;
|
||||||
|
|
||||||
if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE) {
|
if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE) {
|
||||||
php_error(E_ERROR, "error encoding SoapVar");
|
php_error(E_ERROR, "SOAP-ERROR: Encoding: SoapVar hasn't 'enc_type' property");
|
||||||
}
|
}
|
||||||
cur_type = Z_LVAL_P(*ztype);
|
cur_type = Z_LVAL_P(*ztype);
|
||||||
} else if (Z_TYPE_PP(tmp) == IS_ARRAY && is_map(*tmp)) {
|
} else if (Z_TYPE_PP(tmp) == IS_ARRAY && is_map(*tmp)) {
|
||||||
|
@ -2495,27 +2531,6 @@ static void get_type_str(xmlNodePtr node, const char* ns, const char* type, smar
|
||||||
smart_str_0(ret);
|
smart_str_0(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
smart_str *build_soap_action(zval *this_ptr, char *soapaction)
|
|
||||||
{
|
|
||||||
zval **uri;
|
|
||||||
smart_str *tmp;
|
|
||||||
TSRMLS_FETCH();
|
|
||||||
|
|
||||||
tmp = emalloc(sizeof(smart_str));
|
|
||||||
memset(tmp, 0, sizeof(smart_str));
|
|
||||||
|
|
||||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri"), (void *)&uri) == FAILURE) {
|
|
||||||
php_error(E_ERROR, "Error finding uri");
|
|
||||||
}
|
|
||||||
|
|
||||||
smart_str_appendl(tmp, Z_STRVAL_PP(uri), Z_STRLEN_PP(uri));
|
|
||||||
smart_str_appends(tmp, "#");
|
|
||||||
smart_str_appendl(tmp, soapaction, strlen(soapaction));
|
|
||||||
smart_str_0(tmp);
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void delete_mapping(void *data)
|
static void delete_mapping(void *data)
|
||||||
{
|
{
|
||||||
soapMappingPtr map = (soapMappingPtr)data;
|
soapMappingPtr map = (soapMappingPtr)data;
|
||||||
|
|
|
@ -162,8 +162,6 @@ struct _encode {
|
||||||
xmlNodePtr (*to_xml_after)(encodeTypePtr type, xmlNodePtr data, int style);
|
xmlNodePtr (*to_xml_after)(encodeTypePtr type, xmlNodePtr data, int style);
|
||||||
};
|
};
|
||||||
|
|
||||||
smart_str *build_soap_action(zval *this_ptr, char *soapaction);
|
|
||||||
|
|
||||||
/* Master functions all encode/decode should be called thur these functions */
|
/* Master functions all encode/decode should be called thur these functions */
|
||||||
xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr parent);
|
xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr parent);
|
||||||
zval *master_to_zval(encodePtr encode, xmlNodePtr data);
|
zval *master_to_zval(encodePtr encode, xmlNodePtr data);
|
||||||
|
|
|
@ -16,6 +16,7 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *so
|
||||||
php_url *phpurl = NULL;
|
php_url *phpurl = NULL;
|
||||||
php_stream *stream;
|
php_stream *stream;
|
||||||
zval **trace, **tmp;
|
zval **trace, **tmp;
|
||||||
|
int old_error_reporting;
|
||||||
|
|
||||||
if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) {
|
if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -29,7 +30,7 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *so
|
||||||
|
|
||||||
xmlDocDumpMemory(doc, &buf, &buf_size);
|
xmlDocDumpMemory(doc, &buf, &buf_size);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
add_soap_fault(this_ptr, "Client", "Error build soap request", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Error build soap request", NULL, NULL TSRMLS_CC);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
|
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
|
||||||
|
@ -59,7 +60,7 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *so
|
||||||
}
|
}
|
||||||
if (phpurl == NULL) {
|
if (phpurl == NULL) {
|
||||||
xmlFree(buf);
|
xmlFree(buf);
|
||||||
add_soap_fault(this_ptr, "Client", "Unable to parse URL", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Unable to parse URL", NULL, NULL TSRMLS_CC);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *so
|
||||||
if (use_ssl && php_stream_locate_url_wrapper("https://", NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) == NULL) {
|
if (use_ssl && php_stream_locate_url_wrapper("https://", NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) == NULL) {
|
||||||
xmlFree(buf);
|
xmlFree(buf);
|
||||||
php_url_free(phpurl);
|
php_url_free(phpurl);
|
||||||
add_soap_fault(this_ptr, "Client", "SSL support not available in this build", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "SSL support not available in this build", NULL, NULL TSRMLS_CC);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,22 +85,28 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *so
|
||||||
|
|
||||||
reslen = spprintf(&res, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", phpurl->host, phpurl->port);
|
reslen = spprintf(&res, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", phpurl->host, phpurl->port);
|
||||||
|
|
||||||
|
old_error_reporting = EG(error_reporting);
|
||||||
|
EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
|
||||||
stream = php_stream_xport_create(res, reslen,
|
stream = php_stream_xport_create(res, reslen,
|
||||||
ENFORCE_SAFE_MODE | REPORT_ERRORS,
|
ENFORCE_SAFE_MODE | REPORT_ERRORS,
|
||||||
STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
|
STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
|
||||||
NULL /*persistent_id*/,
|
NULL /*persistent_id*/,
|
||||||
NULL /*timeout*/,
|
NULL /*timeout*/,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
EG(error_reporting) = old_error_reporting;
|
||||||
|
|
||||||
efree(res);
|
efree(res);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
old_error_reporting = EG(error_reporting);
|
||||||
|
EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
|
||||||
stream = php_stream_sock_open_host(phpurl->host, (unsigned short)phpurl->port, SOCK_STREAM, NULL, NULL);
|
stream = php_stream_sock_open_host(phpurl->host, (unsigned short)phpurl->port, SOCK_STREAM, NULL, NULL);
|
||||||
|
EG(error_reporting) = old_error_reporting;
|
||||||
if (use_ssl) {
|
if (use_ssl) {
|
||||||
if (FAILURE == php_stream_sock_ssl_activate(stream, 1)) {
|
if (FAILURE == php_stream_sock_ssl_activate(stream, 1)) {
|
||||||
xmlFree(buf);
|
xmlFree(buf);
|
||||||
php_url_free(phpurl);
|
php_url_free(phpurl);
|
||||||
add_soap_fault(this_ptr, "Client", "SSL Connection attempt failed", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "SSL Connection attempt failed", NULL, NULL TSRMLS_CC);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +118,7 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *so
|
||||||
} else {
|
} else {
|
||||||
xmlFree(buf);
|
xmlFree(buf);
|
||||||
php_url_free(phpurl);
|
php_url_free(phpurl);
|
||||||
add_soap_fault(this_ptr, "Client", "Could not connect to host", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Could not connect to host", NULL, NULL TSRMLS_CC);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,7 +209,7 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *so
|
||||||
smart_str_free(&soap_headers);
|
smart_str_free(&soap_headers);
|
||||||
php_stream_close(stream);
|
php_stream_close(stream);
|
||||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
||||||
add_soap_fault(this_ptr, "Client", "Failed Sending HTTP SOAP request", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Failed Sending HTTP SOAP request", NULL, NULL TSRMLS_CC);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
smart_str_free(&soap_headers);
|
smart_str_free(&soap_headers);
|
||||||
|
@ -235,7 +242,7 @@ int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS
|
||||||
if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
|
if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
|
||||||
php_stream_close(stream);
|
php_stream_close(stream);
|
||||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
||||||
add_soap_fault(this_ptr, "Client", "Error Fetching http headers", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Error Fetching http headers", NULL, NULL TSRMLS_CC);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,23 +266,23 @@ int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS
|
||||||
|
|
||||||
if (http_status >= 200 && http_status < 300) {
|
if (http_status >= 200 && http_status < 300) {
|
||||||
} else if (http_status >= 300 && http_status < 400) {
|
} else if (http_status >= 300 && http_status < 400) {
|
||||||
add_soap_fault(this_ptr, "Client", "HTTTP redirection is not supported", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "HTTTP redirection is not supported", NULL, NULL TSRMLS_CC);
|
||||||
} else if (http_status == 400) {
|
} else if (http_status == 400) {
|
||||||
add_soap_fault(this_ptr, "Client", "Bad Request", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Bad Request", NULL, NULL TSRMLS_CC);
|
||||||
} else if (http_status == 401) {
|
} else if (http_status == 401) {
|
||||||
add_soap_fault(this_ptr, "Client", "Unauthorized Request", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Unauthorized Request", NULL, NULL TSRMLS_CC);
|
||||||
} else if (http_status == 405) {
|
} else if (http_status == 405) {
|
||||||
add_soap_fault(this_ptr, "Client", "Method not allowed", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Method not allowed", NULL, NULL TSRMLS_CC);
|
||||||
} else if (http_status == 415) {
|
} else if (http_status == 415) {
|
||||||
add_soap_fault(this_ptr, "Client", "Unsupported Media Type", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Unsupported Media Type", NULL, NULL TSRMLS_CC);
|
||||||
} else if (http_status >= 400 && http_status < 500) {
|
} else if (http_status >= 400 && http_status < 500) {
|
||||||
add_soap_fault(this_ptr, "Client", "Client Error", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Client Error", NULL, NULL TSRMLS_CC);
|
||||||
} else if (http_status == 500) {
|
} else if (http_status == 500) {
|
||||||
add_soap_fault(this_ptr, "Server", "Internal Server Error", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Internal Server Error", NULL, NULL TSRMLS_CC);
|
||||||
} else if (http_status >= 500 && http_status < 600) {
|
} else if (http_status >= 500 && http_status < 600) {
|
||||||
add_soap_fault(this_ptr, "Server", "Server Error", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Server Error", NULL, NULL TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
add_soap_fault(this_ptr, "Client", "Unsupported HTTP status code", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Unsupported HTTP status code", NULL, NULL TSRMLS_CC);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -285,7 +292,7 @@ int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS
|
||||||
if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
|
if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
|
||||||
php_stream_close(stream);
|
php_stream_close(stream);
|
||||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
||||||
add_soap_fault(this_ptr, "Client", "Error Fetching http headers", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Error Fetching http headers", NULL, NULL TSRMLS_CC);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,7 +306,7 @@ int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS
|
||||||
if (!get_http_body(stream, http_headers, &http_body, &http_body_size TSRMLS_CC)) {
|
if (!get_http_body(stream, http_headers, &http_body, &http_body_size TSRMLS_CC)) {
|
||||||
php_stream_close(stream);
|
php_stream_close(stream);
|
||||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
||||||
add_soap_fault(this_ptr, "Client", "Error Fetching http body", NULL, NULL TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Error Fetching http body, No Content-Length or chunked data", NULL, NULL TSRMLS_CC);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +352,7 @@ int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS
|
||||||
zval *err;
|
zval *err;
|
||||||
MAKE_STD_ZVAL(err);
|
MAKE_STD_ZVAL(err);
|
||||||
ZVAL_STRINGL(err, http_body, http_body_size, 1);
|
ZVAL_STRINGL(err, http_body, http_body_size, 1);
|
||||||
add_soap_fault(this_ptr, "Client", "Didn't recieve an xml document", NULL, err TSRMLS_CC);
|
add_soap_fault(this_ptr, "HTTP", "Didn't recieve an xml document", NULL, err TSRMLS_CC);
|
||||||
efree(content_type);
|
efree(content_type);
|
||||||
efree(http_headers);
|
efree(http_headers);
|
||||||
efree(http_body);
|
efree(http_body);
|
||||||
|
@ -505,7 +512,6 @@ static int get_http_body(php_stream *stream, char *headers, char **response, in
|
||||||
http_buf[size] = '\0';
|
http_buf[size] = '\0';
|
||||||
efree(content_length);
|
efree(content_length);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Don't know how to read http body, No Content-Length or chunked data");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,6 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add_assoc_zval(return_value, param->paramName, tmp);
|
add_assoc_zval(return_value, param->paramName, tmp);
|
||||||
/*add_assoc_zval(return_value, (char*)val->name, tmp);*/
|
|
||||||
|
|
||||||
param_count++;
|
param_count++;
|
||||||
|
|
||||||
|
|
|
@ -146,22 +146,22 @@ static void schema_load_file(sdlPtr sdl, xmlAttrPtr ns, xmlChar *location, xmlAt
|
||||||
doc = xmlParseFile(location);
|
doc = xmlParseFile(location);
|
||||||
xmlCleanupParser();
|
xmlCleanupParser();
|
||||||
if (doc == NULL) {
|
if (doc == NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (can't import schema from '%s')",location);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't import schema from '%s'",location);
|
||||||
}
|
}
|
||||||
schema = get_node(doc->children, "schema");
|
schema = get_node(doc->children, "schema");
|
||||||
if (schema == NULL) {
|
if (schema == NULL) {
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
php_error(E_ERROR, "Error parsing schema (can't import schema from '%s')",location);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't import schema from '%s'",location);
|
||||||
}
|
}
|
||||||
new_tns = get_attribute(schema->properties, "targetNamespace");
|
new_tns = get_attribute(schema->properties, "targetNamespace");
|
||||||
if (import) {
|
if (import) {
|
||||||
if (ns != NULL && (new_tns == NULL || strcmp(ns->children->content,new_tns->children->content) != 0)) {
|
if (ns != NULL && (new_tns == NULL || strcmp(ns->children->content,new_tns->children->content) != 0)) {
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
php_error(E_ERROR, "Error parsing schema (can't import schema from '%s', unexpected 'targetNamespace'='%s')",location,new_tns->children->content);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't import schema from '%s', unexpected 'targetNamespace'='%s'",location,new_tns->children->content);
|
||||||
}
|
}
|
||||||
if (ns == NULL && new_tns != NULL) {
|
if (ns == NULL && new_tns != NULL) {
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
php_error(E_ERROR, "Error parsing schema (can't import schema from '%s', unexpected 'targetNamespace'='%s')",location,new_tns->children->content);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't import schema from '%s', unexpected 'targetNamespace'='%s'",location,new_tns->children->content);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
new_tns = get_attribute(schema->properties, "targetNamespace");
|
new_tns = get_attribute(schema->properties, "targetNamespace");
|
||||||
|
@ -172,7 +172,7 @@ static void schema_load_file(sdlPtr sdl, xmlAttrPtr ns, xmlChar *location, xmlAt
|
||||||
}
|
}
|
||||||
} else if (tns != NULL && strcmp(tns->children->content,new_tns->children->content) != 0) {
|
} else if (tns != NULL && strcmp(tns->children->content,new_tns->children->content) != 0) {
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
php_error(E_ERROR, "Error parsing schema (can't include schema from '%s', different 'targetNamespace')",location);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't include schema from '%s', different 'targetNamespace'",location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zend_hash_add(&sdl->docs, location, strlen(location)+1, (void**)&doc, sizeof(xmlDocPtr), NULL);
|
zend_hash_add(&sdl->docs, location, strlen(location)+1, (void**)&doc, sizeof(xmlDocPtr), NULL);
|
||||||
|
@ -224,7 +224,7 @@ int load_schema(sdlPtr sdl,xmlNodePtr schema)
|
||||||
|
|
||||||
location = get_attribute(trav->properties, "schemaLocation");
|
location = get_attribute(trav->properties, "schemaLocation");
|
||||||
if (location == NULL) {
|
if (location == NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (include has no 'schemaLocation' attribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: include has no 'schemaLocation' attribute");
|
||||||
} else {
|
} else {
|
||||||
xmlChar *uri;
|
xmlChar *uri;
|
||||||
xmlChar *base = xmlNodeGetBase(trav->doc, trav);
|
xmlChar *base = xmlNodeGetBase(trav->doc, trav);
|
||||||
|
@ -244,7 +244,7 @@ int load_schema(sdlPtr sdl,xmlNodePtr schema)
|
||||||
|
|
||||||
location = get_attribute(trav->properties, "schemaLocation");
|
location = get_attribute(trav->properties, "schemaLocation");
|
||||||
if (location == NULL) {
|
if (location == NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (redefine has no 'schemaLocation' attribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: redefine has no 'schemaLocation' attribute");
|
||||||
} else {
|
} else {
|
||||||
xmlChar *uri;
|
xmlChar *uri;
|
||||||
xmlChar *base = xmlNodeGetBase(trav->doc, trav);
|
xmlChar *base = xmlNodeGetBase(trav->doc, trav);
|
||||||
|
@ -268,7 +268,7 @@ int load_schema(sdlPtr sdl,xmlNodePtr schema)
|
||||||
location = get_attribute(trav->properties, "schemaLocation");
|
location = get_attribute(trav->properties, "schemaLocation");
|
||||||
|
|
||||||
if (ns != NULL && tns != NULL && strcmp(ns->children->content,tns->children->content) == 0) {
|
if (ns != NULL && tns != NULL && strcmp(ns->children->content,tns->children->content) == 0) {
|
||||||
php_error(E_ERROR, "Error parsing schema (can't import schema from '%s', namespace must not match the enclosing schema 'targetNamespace')",location->children->content);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't import schema from '%s', namespace must not match the enclosing schema 'targetNamespace'",location->children->content);
|
||||||
}
|
}
|
||||||
if (location) {
|
if (location) {
|
||||||
xmlChar *base = xmlNodeGetBase(trav->doc, trav);
|
xmlChar *base = xmlNodeGetBase(trav->doc, trav);
|
||||||
|
@ -315,7 +315,7 @@ int load_schema(sdlPtr sdl,xmlNodePtr schema)
|
||||||
} else if (node_is_equal(trav,"annotation")) {
|
} else if (node_is_equal(trav,"annotation")) {
|
||||||
/* TODO: <annotation> support */
|
/* TODO: <annotation> support */
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in schema)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in schema",trav->name);
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ static int schema_simpleType(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr simpleType,
|
||||||
|
|
||||||
create_encoder(sdl, cur_type, ns->children->content, name->children->content);
|
create_encoder(sdl, cur_type, ns->children->content, name->children->content);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (simpleType has no 'name' attribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: simpleType has no 'name' attribute");
|
||||||
}
|
}
|
||||||
|
|
||||||
trav = simpleType->children;
|
trav = simpleType->children;
|
||||||
|
@ -417,13 +417,13 @@ static int schema_simpleType(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr simpleType,
|
||||||
schema_union(sdl, tsn, trav, cur_type);
|
schema_union(sdl, tsn, trav, cur_type);
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in simpleType)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in simpleType",trav->name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (expected <restriction>, <list> or <union> in simpleType)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: expected <restriction>, <list> or <union> in simpleType");
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in simpleType)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in simpleType",trav->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -479,7 +479,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypeP
|
||||||
sdlTypePtr newType, *tmp;
|
sdlTypePtr newType, *tmp;
|
||||||
|
|
||||||
if (itemType != NULL) {
|
if (itemType != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (element have both 'itemType' attribute and subtype)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'itemType' attribute and subtype");
|
||||||
}
|
}
|
||||||
|
|
||||||
newType = malloc(sizeof(sdlType));
|
newType = malloc(sizeof(sdlType));
|
||||||
|
@ -498,7 +498,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr listType, sdlTypeP
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in list)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in list",trav->name);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -571,7 +571,7 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTyp
|
||||||
sdlTypePtr newType, *tmp;
|
sdlTypePtr newType, *tmp;
|
||||||
|
|
||||||
if (memberTypes != NULL) {
|
if (memberTypes != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (union have both 'memberTypes' attribute and subtypes)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: union has both 'memberTypes' attribute and subtypes");
|
||||||
}
|
}
|
||||||
|
|
||||||
newType = malloc(sizeof(sdlType));
|
newType = malloc(sizeof(sdlType));
|
||||||
|
@ -589,12 +589,12 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr unionType, sdlTyp
|
||||||
schema_simpleType(sdl, tsn, trav, newType);
|
schema_simpleType(sdl, tsn, trav, newType);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in union)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in union",trav->name);
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in union)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in union",trav->name);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -625,13 +625,13 @@ static int schema_simpleContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr simpCompT
|
||||||
schema_extension_simpleContent(sdl, tsn, trav, cur_type);
|
schema_extension_simpleContent(sdl, tsn, trav, cur_type);
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in simpleContent)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in simpleContent",trav->name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (expected <restriction> or <extension> in simpleContent)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: expected <restriction> or <extension> in simpleContent");
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in simpleContent)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in simpleContent",trav->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -669,7 +669,7 @@ static int schema_restriction_simpleContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodeP
|
||||||
if (type) {efree(type);}
|
if (type) {efree(type);}
|
||||||
if (ns) {efree(ns);}
|
if (ns) {efree(ns);}
|
||||||
} else if (!simpleType) {
|
} else if (!simpleType) {
|
||||||
php_error(E_ERROR, "Error parsing schema (restriction has no 'base' attribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: restriction has no 'base' attribute");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur_type->restrictions == NULL) {
|
if (cur_type->restrictions == NULL) {
|
||||||
|
@ -734,13 +734,13 @@ static int schema_restriction_simpleContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodeP
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in restriction)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in restriction",trav->name);
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in restriction)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in restriction",trav->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -772,7 +772,7 @@ static int schema_restriction_complexContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNode
|
||||||
if (type) {efree(type);}
|
if (type) {efree(type);}
|
||||||
if (ns) {efree(ns);}
|
if (ns) {efree(ns);}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (restriction has no 'base' attribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: restriction has no 'base' attribute");
|
||||||
}
|
}
|
||||||
|
|
||||||
trav = restType->children;
|
trav = restType->children;
|
||||||
|
@ -805,12 +805,12 @@ static int schema_restriction_complexContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNode
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in restriction)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in restriction",trav->name);
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in restriction)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in restriction",trav->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -835,7 +835,7 @@ static int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valp
|
||||||
|
|
||||||
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 (missing restriction value)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: missing restriction value");
|
||||||
}
|
}
|
||||||
|
|
||||||
(*valptr)->value = atoi(value->children->content);
|
(*valptr)->value = atoi(value->children->content);
|
||||||
|
@ -863,7 +863,7 @@ static int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *va
|
||||||
|
|
||||||
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 (missing restriction value)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: missing restriction value");
|
||||||
}
|
}
|
||||||
|
|
||||||
(*valptr)->value = strdup(value->children->content);
|
(*valptr)->value = strdup(value->children->content);
|
||||||
|
@ -897,7 +897,7 @@ static int schema_extension_simpleContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr
|
||||||
if (type) {efree(type);}
|
if (type) {efree(type);}
|
||||||
if (ns) {efree(ns);}
|
if (ns) {efree(ns);}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (extension has no 'base' attribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: extension has no 'base' attribute");
|
||||||
}
|
}
|
||||||
|
|
||||||
trav = extType->children;
|
trav = extType->children;
|
||||||
|
@ -915,12 +915,12 @@ static int schema_extension_simpleContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in extension)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in extension",trav->name);
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in extension)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in extension",trav->name);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -952,7 +952,7 @@ static int schema_extension_complexContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePt
|
||||||
if (type) {efree(type);}
|
if (type) {efree(type);}
|
||||||
if (ns) {efree(ns);}
|
if (ns) {efree(ns);}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (extension has no 'base' attribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: extension has no 'base' attribute");
|
||||||
}
|
}
|
||||||
|
|
||||||
trav = extType->children;
|
trav = extType->children;
|
||||||
|
@ -985,12 +985,12 @@ static int schema_extension_complexContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePt
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in extension)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in extension",trav->name);
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in extension)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in extension",trav->name);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1046,7 +1046,7 @@ static int schema_all(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr all, sdlTypePtr cur
|
||||||
if (node_is_equal(trav,"element")) {
|
if (node_is_equal(trav,"element")) {
|
||||||
schema_element(sdl, tsn, trav, cur_type, newModel);
|
schema_element(sdl, tsn, trav, cur_type, newModel);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in all)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in all",trav->name);
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
|
@ -1126,7 +1126,7 @@ static int schema_group(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTyp
|
||||||
zend_hash_init(sdl->groups, 0, NULL, delete_type, 1);
|
zend_hash_init(sdl->groups, 0, NULL, delete_type, 1);
|
||||||
}
|
}
|
||||||
if (zend_hash_add(sdl->groups, key.c, key.len+1, (void**)&newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
|
if (zend_hash_add(sdl->groups, key.c, key.len+1, (void**)&newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
|
||||||
php_error(E_ERROR, "Error parsing schema (group '%s' already defined)",key.c);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: group '%s' already defined",key.c);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_type = newType;
|
cur_type = newType;
|
||||||
|
@ -1139,7 +1139,7 @@ static int schema_group(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTyp
|
||||||
zend_hash_next_index_insert(model->u.content, &newModel, sizeof(sdlContentModelPtr), NULL);
|
zend_hash_next_index_insert(model->u.content, &newModel, sizeof(sdlContentModelPtr), NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (group has no 'name' nor 'ref' attributes)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: group has no 'name' nor 'ref' attributes");
|
||||||
}
|
}
|
||||||
|
|
||||||
newModel->min_occurs = 1;
|
newModel->min_occurs = 1;
|
||||||
|
@ -1167,31 +1167,31 @@ static int schema_group(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTyp
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
if (node_is_equal(trav,"choice")) {
|
if (node_is_equal(trav,"choice")) {
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (group have both 'ref' attribute and subcontent)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: group has both 'ref' attribute and subcontent");
|
||||||
}
|
}
|
||||||
newModel->kind = XSD_CONTENT_CHOICE;
|
newModel->kind = XSD_CONTENT_CHOICE;
|
||||||
schema_choice(sdl, tsn, trav, cur_type, newModel);
|
schema_choice(sdl, tsn, trav, cur_type, newModel);
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
} else if (node_is_equal(trav,"sequence")) {
|
} else if (node_is_equal(trav,"sequence")) {
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (group have both 'ref' attribute and subcontent)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: group has both 'ref' attribute and subcontent");
|
||||||
}
|
}
|
||||||
newModel->kind = XSD_CONTENT_SEQUENCE;
|
newModel->kind = XSD_CONTENT_SEQUENCE;
|
||||||
schema_sequence(sdl, tsn, trav, cur_type, newModel);
|
schema_sequence(sdl, tsn, trav, cur_type, newModel);
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
} else if (node_is_equal(trav,"all")) {
|
} else if (node_is_equal(trav,"all")) {
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (group have both 'ref' attribute and subcontent)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: group has both 'ref' attribute and subcontent");
|
||||||
}
|
}
|
||||||
newModel->kind = XSD_CONTENT_ALL;
|
newModel->kind = XSD_CONTENT_ALL;
|
||||||
schema_all(sdl, tsn, trav, cur_type, newModel);
|
schema_all(sdl, tsn, trav, cur_type, newModel);
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in group)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in group",trav->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in group)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in group",trav->name);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1254,7 +1254,7 @@ static int schema_choice(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlT
|
||||||
} else if (node_is_equal(trav,"any")) {
|
} else if (node_is_equal(trav,"any")) {
|
||||||
schema_any(sdl, tsn, trav, cur_type, newModel);
|
schema_any(sdl, tsn, trav, cur_type, newModel);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in choice)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in choice",trav->name);
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
|
@ -1320,7 +1320,7 @@ static int schema_sequence(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr seqType, sdlTy
|
||||||
} else if (node_is_equal(trav,"any")) {
|
} else if (node_is_equal(trav,"any")) {
|
||||||
schema_any(sdl, tsn, trav, cur_type, newModel);
|
schema_any(sdl, tsn, trav, cur_type, newModel);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in sequence)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in sequence",trav->name);
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
|
@ -1360,13 +1360,13 @@ static int schema_complexContent(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr compCont
|
||||||
schema_extension_complexContent(sdl, tsn, trav, cur_type);
|
schema_extension_complexContent(sdl, tsn, trav, cur_type);
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in complexContent)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in complexContent",trav->name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (<restriction> or <extension> expected in complexContent)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: <restriction> or <extension> expected in complexContent");
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in complexContent)", trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in complexContent", trav->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1443,7 +1443,7 @@ static int schema_complexType(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr compType, s
|
||||||
cur_type = (*ptr);
|
cur_type = (*ptr);
|
||||||
create_encoder(sdl, cur_type, ns->children->content, name->children->content);
|
create_encoder(sdl, cur_type, ns->children->content, name->children->content);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (complexType has no 'name' attribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: complexType has no 'name' attribute");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1483,14 +1483,14 @@ static int schema_complexType(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr compType, s
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema ---(unexpected <%s> in complexType)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in complexType",trav->name);
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema +++(unexpected <%s> in complexType)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in complexType",trav->name);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1581,7 +1581,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTyp
|
||||||
smart_str_0(&key);
|
smart_str_0(&key);
|
||||||
if (zend_hash_add(addHash, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
|
if (zend_hash_add(addHash, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
|
||||||
if (cur_type == NULL) {
|
if (cur_type == NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (element '%s' already defined)",key.c);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element '%s' already defined",key.c);
|
||||||
} else {
|
} else {
|
||||||
zend_hash_next_index_insert(addHash, &newType, sizeof(sdlTypePtr), NULL);
|
zend_hash_next_index_insert(addHash, &newType, sizeof(sdlTypePtr), NULL);
|
||||||
}
|
}
|
||||||
|
@ -1614,7 +1614,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTyp
|
||||||
}
|
}
|
||||||
cur_type = newType;
|
cur_type = newType;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (element has no 'name' nor 'ref' attributes)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has no 'name' nor 'ref' attributes");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nillable = boolean : false */
|
/* nillable = boolean : false */
|
||||||
|
@ -1622,7 +1622,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTyp
|
||||||
attr = get_attribute(attrs, "nillable");
|
attr = get_attribute(attrs, "nillable");
|
||||||
if (attr) {
|
if (attr) {
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (element have both 'ref' and 'nillable' attributes)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' and 'nillable' attributes");
|
||||||
}
|
}
|
||||||
if (!stricmp(attr->children->content, "true") ||
|
if (!stricmp(attr->children->content, "true") ||
|
||||||
!stricmp(attr->children->content, "1")) {
|
!stricmp(attr->children->content, "1")) {
|
||||||
|
@ -1637,7 +1637,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTyp
|
||||||
attr = get_attribute(attrs, "fixed");
|
attr = get_attribute(attrs, "fixed");
|
||||||
if (attr) {
|
if (attr) {
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (element have both 'ref' and 'fixed' attributes)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' and 'fixed' attributes");
|
||||||
}
|
}
|
||||||
cur_type->fixed = strdup(attr->children->content);
|
cur_type->fixed = strdup(attr->children->content);
|
||||||
}
|
}
|
||||||
|
@ -1645,9 +1645,9 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTyp
|
||||||
attr = get_attribute(attrs, "default");
|
attr = get_attribute(attrs, "default");
|
||||||
if (attr) {
|
if (attr) {
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (element have both 'ref' and 'fixed' attributes)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' and 'fixed' attributes");
|
||||||
} else if (ref != NULL) {
|
} else if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (element have both 'default' and 'fixed' attributes)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'default' and 'fixed' attributes");
|
||||||
}
|
}
|
||||||
cur_type->def = strdup(attr->children->content);
|
cur_type->def = strdup(attr->children->content);
|
||||||
}
|
}
|
||||||
|
@ -1659,7 +1659,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTyp
|
||||||
xmlNsPtr nsptr;
|
xmlNsPtr nsptr;
|
||||||
|
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (element have both 'ref' and 'type' attributes)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' and 'type' attributes");
|
||||||
}
|
}
|
||||||
parse_namespace(type->children->content, &cptype, &str_ns);
|
parse_namespace(type->children->content, &cptype, &str_ns);
|
||||||
nsptr = xmlSearchNs(element->doc, element, str_ns);
|
nsptr = xmlSearchNs(element->doc, element, str_ns);
|
||||||
|
@ -1678,17 +1678,17 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTyp
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
if (node_is_equal(trav,"simpleType")) {
|
if (node_is_equal(trav,"simpleType")) {
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (element have both 'ref' attribute and subtype)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' attribute and subtype");
|
||||||
} else if (type != NULL) {
|
} else if (type != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (element have both 'type' attribute and subtype)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'type' attribute and subtype");
|
||||||
}
|
}
|
||||||
schema_simpleType(sdl, tsn, trav, cur_type);
|
schema_simpleType(sdl, tsn, trav, cur_type);
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
} else if (node_is_equal(trav,"complexType")) {
|
} else if (node_is_equal(trav,"complexType")) {
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (element have both 'ref' attribute and subtype)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' attribute and subtype");
|
||||||
} else if (type != NULL) {
|
} else if (type != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (element have both 'type' attribute and subtype)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'type' attribute and subtype");
|
||||||
}
|
}
|
||||||
schema_complexType(sdl, tsn, trav, cur_type);
|
schema_complexType(sdl, tsn, trav, cur_type);
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
|
@ -1702,7 +1702,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTyp
|
||||||
} else if (node_is_equal(trav,"key")) {
|
} else if (node_is_equal(trav,"key")) {
|
||||||
/* TODO: <keyref> support */
|
/* TODO: <keyref> support */
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in element)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in element",trav->name);
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
|
@ -1786,11 +1786,11 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdl
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zend_hash_add(addHash, key.c, key.len + 1, &newAttr, sizeof(sdlAttributePtr), NULL) != SUCCESS) {
|
if (zend_hash_add(addHash, key.c, key.len + 1, &newAttr, sizeof(sdlAttributePtr), NULL) != SUCCESS) {
|
||||||
php_error(E_ERROR, "Error parsing schema (attribute '%s' already defined)", key.c);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attribute '%s' already defined", key.c);
|
||||||
}
|
}
|
||||||
smart_str_free(&key);
|
smart_str_free(&key);
|
||||||
} else{
|
} else{
|
||||||
php_error(E_ERROR, "Error parsing schema (attribute has no 'name' nor 'ref' attributes)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attribute has no 'name' nor 'ref' attributes");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* type = QName */
|
/* type = QName */
|
||||||
|
@ -1800,7 +1800,7 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdl
|
||||||
xmlNsPtr nsptr;
|
xmlNsPtr nsptr;
|
||||||
|
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (attribute have both 'ref' and 'type' attributes)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attribute has both 'ref' and 'type' attributes");
|
||||||
}
|
}
|
||||||
parse_namespace(type->children->content, &cptype, &str_ns);
|
parse_namespace(type->children->content, &cptype, &str_ns);
|
||||||
nsptr = xmlSearchNs(attrType->doc, attrType, str_ns);
|
nsptr = xmlSearchNs(attrType->doc, attrType, str_ns);
|
||||||
|
@ -1874,9 +1874,9 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdl
|
||||||
if (node_is_equal(trav,"simpleType")) {
|
if (node_is_equal(trav,"simpleType")) {
|
||||||
sdlTypePtr dummy_type;
|
sdlTypePtr dummy_type;
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (attribute have both 'ref' attribute and subtype)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attribute has both 'ref' attribute and subtype");
|
||||||
} else if (type != NULL) {
|
} else if (type != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (attribute have both 'type' attribute and subtype)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attribute has both 'type' attribute and subtype");
|
||||||
}
|
}
|
||||||
dummy_type = malloc(sizeof(sdlType));
|
dummy_type = malloc(sizeof(sdlType));
|
||||||
memset(dummy_type, 0, sizeof(sdlType));
|
memset(dummy_type, 0, sizeof(sdlType));
|
||||||
|
@ -1889,7 +1889,7 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in attribute)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in attribute",trav->name);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1930,7 +1930,7 @@ static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrGrou
|
||||||
smart_str_0(&key);
|
smart_str_0(&key);
|
||||||
|
|
||||||
if (zend_hash_add(sdl->attributeGroups, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
|
if (zend_hash_add(sdl->attributeGroups, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
|
||||||
php_error(E_ERROR, "Error parsing schema (attributeGroup '%s' already defined)", key.c);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup '%s' already defined", key.c);
|
||||||
}
|
}
|
||||||
cur_type = newType;
|
cur_type = newType;
|
||||||
smart_str_free(&key);
|
smart_str_free(&key);
|
||||||
|
@ -1964,35 +1964,35 @@ static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrGrou
|
||||||
cur_type = NULL;
|
cur_type = NULL;
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
php_error(E_ERROR, "Error parsing schema (attributeGroup has no 'name' nor 'ref' attributes)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup has no 'name' nor 'ref' attributes");
|
||||||
}
|
}
|
||||||
|
|
||||||
trav = attrGroup->children;
|
trav = attrGroup->children;
|
||||||
while (trav != NULL) {
|
while (trav != NULL) {
|
||||||
if (node_is_equal(trav,"attribute")) {
|
if (node_is_equal(trav,"attribute")) {
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (attributeGroup have both 'ref' attribute and subattribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup has both 'ref' attribute and subattribute");
|
||||||
}
|
}
|
||||||
schema_attribute(sdl, tsn, trav, cur_type);
|
schema_attribute(sdl, tsn, trav, cur_type);
|
||||||
} else if (node_is_equal(trav,"attributeGroup")) {
|
} else if (node_is_equal(trav,"attributeGroup")) {
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (attributeGroup have both 'ref' attribute and subattribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup has both 'ref' attribute and subattribute");
|
||||||
}
|
}
|
||||||
schema_attributeGroup(sdl, tsn, trav, cur_type);
|
schema_attributeGroup(sdl, tsn, trav, cur_type);
|
||||||
} else if (node_is_equal(trav,"anyAttribute")) {
|
} else if (node_is_equal(trav,"anyAttribute")) {
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (attributeGroup have both 'ref' attribute and subattribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup has both 'ref' attribute and subattribute");
|
||||||
}
|
}
|
||||||
/* TODO: <anyAttribute> support */
|
/* TODO: <anyAttribute> support */
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in attributeGroup)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in attributeGroup",trav->name);
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
}
|
}
|
||||||
if (trav != NULL) {
|
if (trav != NULL) {
|
||||||
php_error(E_ERROR, "Error parsing schema (unexpected <%s> in attributeGroup)",trav->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in attributeGroup",trav->name);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -2100,7 +2100,7 @@ static void schema_content_model_fixup(sdlPtr sdl, sdlContentModelPtr model)
|
||||||
model->kind = XSD_CONTENT_GROUP;
|
model->kind = XSD_CONTENT_GROUP;
|
||||||
model->u.group = (*tmp)->model;
|
model->u.group = (*tmp)->model;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unresolved group 'ref' attribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unresolved group 'ref' attribute");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2132,7 +2132,7 @@ static void schema_type_fixup(sdlPtr sdl, sdlTypePtr type)
|
||||||
type->encode = (*tmp)->encode;
|
type->encode = (*tmp)->encode;
|
||||||
/* TODO: nillable */
|
/* TODO: nillable */
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing schema (unresolved element 'ref' attribute)");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unresolved element 'ref' attribute");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
efree(type->ref);
|
efree(type->ref);
|
||||||
|
@ -2210,13 +2210,6 @@ int schema_pass2(sdlPtr sdl)
|
||||||
|
|
||||||
int schema_pass3(sdlPtr sdl)
|
int schema_pass3(sdlPtr sdl)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (sdl->elements) {
|
|
||||||
zend_hash_destroy(sdl->elements);
|
|
||||||
free(sdl->elements);
|
|
||||||
sdl->elements = NULL;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (sdl->attributes) {
|
if (sdl->attributes) {
|
||||||
zend_hash_destroy(sdl->attributes);
|
zend_hash_destroy(sdl->attributes);
|
||||||
free(sdl->attributes);
|
free(sdl->attributes);
|
||||||
|
|
|
@ -155,7 +155,7 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include)
|
||||||
|
|
||||||
|
|
||||||
if (!wsdl) {
|
if (!wsdl) {
|
||||||
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't load from %s", struri);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't load from '%s'", struri);
|
||||||
}
|
}
|
||||||
|
|
||||||
zend_hash_add(&tmpsdl->docs, struri, strlen(struri)+1, (void**)&wsdl, sizeof(xmlDocPtr), NULL);
|
zend_hash_add(&tmpsdl->docs, struri, strlen(struri)+1, (void**)&wsdl, sizeof(xmlDocPtr), NULL);
|
||||||
|
@ -170,7 +170,7 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't find \"definitions\" in %s", struri);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't find <definitions> in '%s'", struri);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!include) {
|
if (!include) {
|
||||||
|
@ -213,7 +213,7 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include)
|
||||||
xmlAttrPtr name = get_attribute(trav->properties, "name");
|
xmlAttrPtr name = get_attribute(trav->properties, "name");
|
||||||
if (name && name->children && name->children->content) {
|
if (name && name->children && name->children->content) {
|
||||||
if (zend_hash_add(&ctx->messages, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
|
if (zend_hash_add(&ctx->messages, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
|
||||||
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL (message '%s' already defined)",name->children->content);
|
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <message> '%s' already defined",name->children->content);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <message> hasn't name attribute");
|
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <message> hasn't name attribute");
|
||||||
|
@ -223,7 +223,7 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include)
|
||||||
xmlAttrPtr name = get_attribute(trav->properties, "name");
|
xmlAttrPtr name = get_attribute(trav->properties, "name");
|
||||||
if (name && name->children && name->children->content) {
|
if (name && name->children && name->children->content) {
|
||||||
if (zend_hash_add(&ctx->portTypes, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
|
if (zend_hash_add(&ctx->portTypes, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
|
||||||
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL (portType '%s' already defined)",name->children->content);
|
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <portType> '%s' already defined",name->children->content);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <portType> hasn't name attribute");
|
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <portType> hasn't name attribute");
|
||||||
|
@ -233,7 +233,7 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include)
|
||||||
xmlAttrPtr name = get_attribute(trav->properties, "name");
|
xmlAttrPtr name = get_attribute(trav->properties, "name");
|
||||||
if (name && name->children && name->children->content) {
|
if (name && name->children && name->children->content) {
|
||||||
if (zend_hash_add(&ctx->bindings, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
|
if (zend_hash_add(&ctx->bindings, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
|
||||||
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL (binding '%s' already defined)",name->children->content);
|
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <binding> '%s' already defined",name->children->content);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <binding> hasn't name attribute");
|
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <binding> hasn't name attribute");
|
||||||
|
@ -243,7 +243,7 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include)
|
||||||
xmlAttrPtr name = get_attribute(trav->properties, "name");
|
xmlAttrPtr name = get_attribute(trav->properties, "name");
|
||||||
if (name && name->children && name->children->content) {
|
if (name && name->children && name->children->content) {
|
||||||
if (zend_hash_add(&ctx->services, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
|
if (zend_hash_add(&ctx->services, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
|
||||||
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL (service '%s' already defined)",name->children->content);
|
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <service> '%s' already defined",name->children->content);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <service> hasn't name attribute");
|
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <service> hasn't name attribute");
|
||||||
|
@ -301,18 +301,18 @@ static sdlPtr load_wsdl(char *struri)
|
||||||
|
|
||||||
bindingAttr = get_attribute(port->properties, "binding");
|
bindingAttr = get_attribute(port->properties, "binding");
|
||||||
if (bindingAttr == NULL) {
|
if (bindingAttr == NULL) {
|
||||||
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No binding associated with port");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No binding associated with <port>");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find address and figure out binding type */
|
/* find address and figure out binding type */
|
||||||
address = get_node(port->children, "address");
|
address = get_node(port->children, "address");
|
||||||
if (!address) {
|
if (!address) {
|
||||||
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No address associated with port");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No address associated with <port>");
|
||||||
}
|
}
|
||||||
|
|
||||||
location = get_attribute(address->properties, "location");
|
location = get_attribute(address->properties, "location");
|
||||||
if (!location) {
|
if (!location) {
|
||||||
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No location associated with port");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No location associated with <port>");
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpbinding->location = strdup(location->children->content);
|
tmpbinding->location = strdup(location->children->content);
|
||||||
|
@ -340,7 +340,7 @@ static sdlPtr load_wsdl(char *struri)
|
||||||
|
|
||||||
parse_namespace(bindingAttr->children->content, &ctype, &ns);
|
parse_namespace(bindingAttr->children->content, &ctype, &ns);
|
||||||
if (zend_hash_find(&ctx.bindings, ctype, strlen(ctype)+1, (void*)&tmp) != SUCCESS) {
|
if (zend_hash_find(&ctx.bindings, ctype, strlen(ctype)+1, (void*)&tmp) != SUCCESS) {
|
||||||
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No binding element with name \"%s\"", ctype);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No <binding> element with name '%s'", ctype);
|
||||||
}
|
}
|
||||||
binding = *tmp;
|
binding = *tmp;
|
||||||
|
|
||||||
|
@ -376,18 +376,18 @@ static sdlPtr load_wsdl(char *struri)
|
||||||
|
|
||||||
name = get_attribute(binding->properties, "name");
|
name = get_attribute(binding->properties, "name");
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
php_error(E_ERROR, "Error parsing wsdl (Missing \"name\" attribute for \"binding\")");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing 'name' attribute for <binding>");
|
||||||
}
|
}
|
||||||
tmpbinding->name = strdup(name->children->content);
|
tmpbinding->name = strdup(name->children->content);
|
||||||
|
|
||||||
type = get_attribute(binding->properties, "type");
|
type = get_attribute(binding->properties, "type");
|
||||||
if (type == NULL) {
|
if (type == NULL) {
|
||||||
php_error(E_ERROR, "Error parsing wsdl (Missing \"type\" attribute for \"binding\")");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing 'type' attribute for <binding>");
|
||||||
}
|
}
|
||||||
parse_namespace(type->children->content, &ctype, &ns);
|
parse_namespace(type->children->content, &ctype, &ns);
|
||||||
|
|
||||||
if (zend_hash_find(&ctx.portTypes, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
|
if (zend_hash_find(&ctx.portTypes, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
|
||||||
php_error(E_ERROR, "Error parsing wsdl (Missing \"portType\" with name \"%s\")", name->children->content);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <portType> with name '%s'", name->children->content);
|
||||||
}
|
}
|
||||||
portType = *tmp;
|
portType = *tmp;
|
||||||
|
|
||||||
|
@ -402,12 +402,12 @@ static sdlPtr load_wsdl(char *struri)
|
||||||
|
|
||||||
op_name = get_attribute(operation->properties, "name");
|
op_name = get_attribute(operation->properties, "name");
|
||||||
if (op_name == NULL) {
|
if (op_name == NULL) {
|
||||||
php_error(E_ERROR, "Error parsing wsdl (Missing \"name\" attribute for \"operation\")");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing 'name' attribute for <operation>");
|
||||||
}
|
}
|
||||||
|
|
||||||
portTypeOperation = get_node_with_attribute(portType->children, "operation", "name", op_name->children->content);
|
portTypeOperation = get_node_with_attribute(portType->children, "operation", "name", op_name->children->content);
|
||||||
if (portTypeOperation == NULL) {
|
if (portTypeOperation == NULL) {
|
||||||
php_error(E_ERROR, "Error parsing wsdl (Missing \"portType/operation\" with name \"%s\")", op_name->children->content);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <portType>/<operation> with name '%s'", op_name->children->content);
|
||||||
}
|
}
|
||||||
|
|
||||||
function = malloc(sizeof(sdlFunction));
|
function = malloc(sizeof(sdlFunction));
|
||||||
|
@ -465,7 +465,7 @@ static sdlPtr load_wsdl(char *struri)
|
||||||
if (portTypeInput) {
|
if (portTypeInput) {
|
||||||
message = get_attribute(portTypeInput->properties, "message");
|
message = get_attribute(portTypeInput->properties, "message");
|
||||||
if (message == NULL) {
|
if (message == NULL) {
|
||||||
php_error(E_ERROR, "Error parsing wsdl (Missing name for \"input\" of \"%s\")", op_name->children->content);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing name for <input> of '%s'", op_name->children->content);
|
||||||
}
|
}
|
||||||
|
|
||||||
name = get_attribute(portTypeInput->properties, "name");
|
name = get_attribute(portTypeInput->properties, "name");
|
||||||
|
@ -480,7 +480,7 @@ static sdlPtr load_wsdl(char *struri)
|
||||||
parse_namespace(message->children->content, &ctype, &ns);
|
parse_namespace(message->children->content, &ctype, &ns);
|
||||||
|
|
||||||
if (zend_hash_find(&ctx.messages, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
|
if (zend_hash_find(&ctx.messages, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
|
||||||
php_error(E_ERROR, "Error parsing wsdl (Missing \"message\" with name \"%s\")", message->children->content);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <message> with name '%s'", message->children->content);
|
||||||
}
|
}
|
||||||
msgInput = *tmp;
|
msgInput = *tmp;
|
||||||
|
|
||||||
|
@ -529,7 +529,7 @@ static sdlPtr load_wsdl(char *struri)
|
||||||
|
|
||||||
name = get_attribute(part->properties, "name");
|
name = get_attribute(part->properties, "name");
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
php_error(E_ERROR, "Error parsing wsdl (No name associated with part \"%s\")", msgInput->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No name associated with <part> '%s'", msgInput->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
param->paramName = strdup(name->children->content);
|
param->paramName = strdup(name->children->content);
|
||||||
|
@ -574,12 +574,12 @@ static sdlPtr load_wsdl(char *struri)
|
||||||
|
|
||||||
message = get_attribute(portTypeOutput->properties, "message");
|
message = get_attribute(portTypeOutput->properties, "message");
|
||||||
if (message == NULL) {
|
if (message == NULL) {
|
||||||
php_error(E_ERROR, "Error parsing wsdl (Missing name for \"output\" of \"%s\")", op_name->children->content);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing name for <output> of '%s'", op_name->children->content);
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_namespace(message->children->content, &ctype, &ns);
|
parse_namespace(message->children->content, &ctype, &ns);
|
||||||
if (zend_hash_find(&ctx.messages, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
|
if (zend_hash_find(&ctx.messages, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
|
||||||
php_error(E_ERROR, "Error parsing wsdl (Missing \"message\" with name \"%s\")", message->children->content);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <message> with name '%s'", message->children->content);
|
||||||
}
|
}
|
||||||
msgOutput = *tmp;
|
msgOutput = *tmp;
|
||||||
|
|
||||||
|
@ -628,7 +628,7 @@ static sdlPtr load_wsdl(char *struri)
|
||||||
|
|
||||||
name = get_attribute(part->properties, "name");
|
name = get_attribute(part->properties, "name");
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
php_error(E_ERROR, "Error parsing wsdl (No name associated with part \"%s\")", msgOutput->name);
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No name associated with <part> '%s'", msgOutput->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
param->paramName = strdup(name->children->content);
|
param->paramName = strdup(name->children->content);
|
||||||
|
@ -696,7 +696,7 @@ static sdlPtr load_wsdl(char *struri)
|
||||||
zend_hash_move_forward(&ctx.services);
|
zend_hash_move_forward(&ctx.services);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Error parsing wsdl (\"Couldn't bind to service\")");
|
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't bind to service");
|
||||||
}
|
}
|
||||||
|
|
||||||
schema_pass3(ctx.root);
|
schema_pass3(ctx.root);
|
||||||
|
|
|
@ -151,44 +151,6 @@ xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, cha
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlNodePtr check_and_resolve_href(xmlNodePtr data)
|
|
||||||
{
|
|
||||||
if (data && data->properties) {
|
|
||||||
xmlAttrPtr href = get_attribute(data->properties, "href");
|
|
||||||
if (href) {
|
|
||||||
/* Internal href try and find node */
|
|
||||||
if (href->children->content[0] == '#') {
|
|
||||||
xmlNodePtr ret = get_node_with_attribute_recursive(data->doc->children, NULL, "id", &href->children->content[1]);
|
|
||||||
if (!ret) {
|
|
||||||
php_error(E_ERROR,"Unresolved reference '%s'",href->children->content);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
} else {
|
|
||||||
/* TODO: External href....? */
|
|
||||||
php_error(E_ERROR,"External reference '%s'",href->children->content);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* SOAP 1.2 enc:id enc:ref */
|
|
||||||
href = get_attribute_ex(data->properties, "ref", SOAP_1_2_ENC_NAMESPACE);
|
|
||||||
if (href) {
|
|
||||||
/* Internal href try and find node */
|
|
||||||
if (href->children->content[0] == '#') {
|
|
||||||
xmlNodePtr ret = get_node_with_attribute_recursive_ex(data->doc->children, NULL, NULL, "id", &href->children->content[1], SOAP_1_2_ENC_NAMESPACE);
|
|
||||||
if (!ret) {
|
|
||||||
php_error(E_ERROR,"Unresolved reference '%s'",href->children->content);
|
|
||||||
} else if (ret == data) {
|
|
||||||
php_error(E_ERROR,"Violation of id and ref information items '%s'",href->children->content);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
} else {
|
|
||||||
/* TODO: External href....? */
|
|
||||||
php_error(E_ERROR,"External reference '%s'",href->children->content);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
int parse_namespace(const char *inval, char **value, char **namespace)
|
int parse_namespace(const char *inval, char **value, char **namespace)
|
||||||
{
|
{
|
||||||
char *found = strchr(inval, ':');
|
char *found = strchr(inval, ':');
|
||||||
|
|
|
@ -19,7 +19,6 @@ xmlNodePtr get_node_recursive_ex(xmlNodePtr node,char *name, char *ns);
|
||||||
xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
|
xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
|
||||||
xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
|
xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
|
||||||
int parse_namespace(const char *inval,char **value,char **namespace);
|
int parse_namespace(const char *inval,char **value,char **namespace);
|
||||||
xmlNodePtr check_and_resolve_href(xmlNodePtr data);
|
|
||||||
|
|
||||||
int php_stream_xmlIO_match_wrapper(const char *filename);
|
int php_stream_xmlIO_match_wrapper(const char *filename);
|
||||||
void *php_stream_xmlIO_open_wrapper(const char *filename);
|
void *php_stream_xmlIO_open_wrapper(const char *filename);
|
||||||
|
|
163
ext/soap/soap.c
163
ext/soap/soap.c
|
@ -46,18 +46,10 @@ static void soap_error_handler(int error_num, const char *error_filename, const
|
||||||
if (ZEND_NUM_ARGS() != 0) \
|
if (ZEND_NUM_ARGS() != 0) \
|
||||||
WRONG_PARAM_COUNT;
|
WRONG_PARAM_COUNT;
|
||||||
|
|
||||||
#define GET_THIS_OBJECT(o) \
|
|
||||||
o = getThis(); \
|
|
||||||
if (!o) { \
|
|
||||||
php_error(E_WARNING, "Cannot Get Class Info"); \
|
|
||||||
return; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define FETCH_THIS_SDL(ss) \
|
#define FETCH_THIS_SDL(ss) \
|
||||||
{ \
|
{ \
|
||||||
zval *__thisObj,**__tmp; \
|
zval **__tmp; \
|
||||||
GET_THIS_OBJECT(__thisObj) \
|
if(FIND_SDL_PROPERTY(this_ptr,__tmp) != FAILURE) { \
|
||||||
if(FIND_SDL_PROPERTY(__thisObj,__tmp) != FAILURE) { \
|
|
||||||
FETCH_SDL_RES(ss,__tmp); \
|
FETCH_SDL_RES(ss,__tmp); \
|
||||||
} else { \
|
} else { \
|
||||||
ss = NULL; \
|
ss = NULL; \
|
||||||
|
@ -69,18 +61,14 @@ static void soap_error_handler(int error_num, const char *error_filename, const
|
||||||
|
|
||||||
#define FETCH_THIS_SERVICE(ss) \
|
#define FETCH_THIS_SERVICE(ss) \
|
||||||
{ \
|
{ \
|
||||||
zval *__thisObj,**__tmp; \
|
zval **tmp; \
|
||||||
GET_THIS_OBJECT(__thisObj) \
|
if (zend_hash_find(Z_OBJPROP_P(this_ptr),"service", sizeof("service"), (void **)&tmp) != FAILURE) { \
|
||||||
if(FIND_SERVICE_PROPERTY(__thisObj,__tmp) != FAILURE) { \
|
ss = (soapServicePtr)zend_fetch_resource(tmp TSRMLS_CC, -1, "service", NULL, 1, le_service); \
|
||||||
FETCH_SERVICE_RES(ss,__tmp); \
|
|
||||||
} else { \
|
} else { \
|
||||||
ss = NULL; \
|
ss = NULL; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FIND_SERVICE_PROPERTY(ss,tmp) zend_hash_find(Z_OBJPROP_P(ss), "service", sizeof("service"), (void **)&tmp)
|
|
||||||
#define FETCH_SERVICE_RES(ss,tmp) ss = (soapServicePtr) zend_fetch_resource(tmp TSRMLS_CC, -1, "service", NULL, 1, le_service)
|
|
||||||
|
|
||||||
static zend_class_entry* soap_class_entry;
|
static zend_class_entry* soap_class_entry;
|
||||||
static zend_class_entry* soap_server_class_entry;
|
static zend_class_entry* soap_server_class_entry;
|
||||||
static zend_class_entry* soap_fault_class_entry;
|
static zend_class_entry* soap_fault_class_entry;
|
||||||
|
@ -298,15 +286,6 @@ static void php_soap_init_globals(zend_soap_globals *soap_globals)
|
||||||
soap_globals->soap_version = SOAP_1_1;
|
soap_globals->soap_version = SOAP_1_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void php_soap_del_globals(zend_soap_globals *soap_globals)
|
|
||||||
{
|
|
||||||
/* zend_hash_destroy(soap_globals->sdls);
|
|
||||||
zend_hash_destroy(soap_globals->services);
|
|
||||||
zend_hash_destroy(soap_globals->defEnc);
|
|
||||||
zend_hash_destroy(soap_globals->defEncIndex);
|
|
||||||
zend_hash_destroy(soap_globals->defEncNs);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
PHP_MSHUTDOWN_FUNCTION(soap)
|
PHP_MSHUTDOWN_FUNCTION(soap)
|
||||||
{
|
{
|
||||||
zend_error_cb = old_error_handler;
|
zend_error_cb = old_error_handler;
|
||||||
|
@ -323,7 +302,7 @@ PHP_MINIT_FUNCTION(soap)
|
||||||
zend_class_entry ce;
|
zend_class_entry ce;
|
||||||
|
|
||||||
/* TODO: add ini entry for always use soap errors */
|
/* TODO: add ini entry for always use soap errors */
|
||||||
ZEND_INIT_MODULE_GLOBALS(soap, php_soap_init_globals, php_soap_del_globals);
|
ZEND_INIT_MODULE_GLOBALS(soap, php_soap_init_globals, NULL);
|
||||||
|
|
||||||
/* Enable php stream/wrapper support for libxml */
|
/* Enable php stream/wrapper support for libxml */
|
||||||
xmlRegisterDefaultInputCallbacks();
|
xmlRegisterDefaultInputCallbacks();
|
||||||
|
@ -499,7 +478,7 @@ PHP_FUNCTION(soap_encode_to_zval)
|
||||||
/* SoapParam functions */
|
/* SoapParam functions */
|
||||||
PHP_METHOD(soapparam,soapparam)
|
PHP_METHOD(soapparam,soapparam)
|
||||||
{
|
{
|
||||||
zval *thisObj, *data;
|
zval *data;
|
||||||
char *name;
|
char *name;
|
||||||
int name_length;
|
int name_length;
|
||||||
|
|
||||||
|
@ -507,13 +486,11 @@ PHP_METHOD(soapparam,soapparam)
|
||||||
php_error(E_ERROR, "Invalid arguments to SoapParam constructor");
|
php_error(E_ERROR, "Invalid arguments to SoapParam constructor");
|
||||||
}
|
}
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
|
||||||
|
|
||||||
#ifndef ZEND_ENGINE_2
|
#ifndef ZEND_ENGINE_2
|
||||||
zval_add_ref(&data);
|
zval_add_ref(&data);
|
||||||
#endif
|
#endif
|
||||||
add_property_stringl(thisObj, "param_name", name, name_length, 1);
|
add_property_stringl(this_ptr, "param_name", name, name_length, 1);
|
||||||
add_property_zval(thisObj, "param_data", data);
|
add_property_zval(this_ptr, "param_data", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SoapFault functions */
|
/* SoapFault functions */
|
||||||
|
@ -521,7 +498,7 @@ PHP_METHOD(soapfault,soapfault)
|
||||||
{
|
{
|
||||||
char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL;
|
char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL;
|
||||||
int fault_string_len, fault_code_len, fault_actor_len;
|
int fault_string_len, fault_code_len, fault_actor_len;
|
||||||
zval *thisObj, *details = NULL;
|
zval *details = NULL;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zs",
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zs",
|
||||||
&fault_code, &fault_code_len,
|
&fault_code, &fault_code_len,
|
||||||
|
@ -530,30 +507,27 @@ PHP_METHOD(soapfault,soapfault)
|
||||||
php_error(E_ERROR, "Invalid arguments to SoapFault constructor");
|
php_error(E_ERROR, "Invalid arguments to SoapFault constructor");
|
||||||
}
|
}
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
set_soap_fault(this_ptr, fault_code, fault_string, fault_actor, details TSRMLS_CC);
|
||||||
|
|
||||||
set_soap_fault(thisObj, fault_code, fault_string, fault_actor, details TSRMLS_CC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SoapVar functions */
|
/* SoapVar functions */
|
||||||
PHP_METHOD(soapvar,soapvar)
|
PHP_METHOD(soapvar,soapvar)
|
||||||
{
|
{
|
||||||
zval *data, *thisObj, *type;
|
zval *data, *type;
|
||||||
char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL;
|
char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL;
|
||||||
int stype_len, ns_len, name_len, namens_len;
|
int stype_len, ns_len, name_len, namens_len;
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!z|ssss", &data, &type, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!z|ssss", &data, &type, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) {
|
||||||
php_error(E_ERROR, "Invalid arguments to SoapVar constructor");
|
php_error(E_ERROR, "Invalid arguments to SoapVar constructor");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Z_TYPE_P(type) == IS_NULL) {
|
if (Z_TYPE_P(type) == IS_NULL) {
|
||||||
add_property_long(thisObj, "enc_type", UNKNOWN_TYPE);
|
add_property_long(this_ptr, "enc_type", UNKNOWN_TYPE);
|
||||||
} else {
|
} else {
|
||||||
if (zend_hash_index_exists(SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type))) {
|
if (zend_hash_index_exists(SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type))) {
|
||||||
add_property_long(thisObj, "enc_type", Z_LVAL_P(type));
|
add_property_long(this_ptr, "enc_type", Z_LVAL_P(type));
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Cannot find encoding for SoapVar");
|
php_error(E_ERROR, "Invalid type ID to SoapVar constructor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,27 +535,26 @@ PHP_METHOD(soapvar,soapvar)
|
||||||
#ifndef ZEND_ENGINE_2
|
#ifndef ZEND_ENGINE_2
|
||||||
zval_add_ref(&data);
|
zval_add_ref(&data);
|
||||||
#endif
|
#endif
|
||||||
add_property_zval(thisObj, "enc_value", data);
|
add_property_zval(this_ptr, "enc_value", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stype && strlen(stype) > 0) {
|
if (stype && strlen(stype) > 0) {
|
||||||
add_property_stringl(thisObj, "enc_stype", stype, stype_len, 1);
|
add_property_stringl(this_ptr, "enc_stype", stype, stype_len, 1);
|
||||||
}
|
}
|
||||||
if (ns && strlen(ns) > 0) {
|
if (ns && strlen(ns) > 0) {
|
||||||
add_property_stringl(thisObj, "enc_ns", ns, ns_len, 1);
|
add_property_stringl(this_ptr, "enc_ns", ns, ns_len, 1);
|
||||||
}
|
}
|
||||||
if (name && strlen(name) > 0) {
|
if (name && strlen(name) > 0) {
|
||||||
add_property_stringl(thisObj, "enc_name", name, name_len, 1);
|
add_property_stringl(this_ptr, "enc_name", name, name_len, 1);
|
||||||
}
|
}
|
||||||
if (namens && strlen(namens) > 0) {
|
if (namens && strlen(namens) > 0) {
|
||||||
add_property_stringl(thisObj, "enc_namens", namens, namens_len, 1);
|
add_property_stringl(this_ptr, "enc_namens", namens, namens_len, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SoapServer functions */
|
/* SoapServer functions */
|
||||||
PHP_METHOD(soapserver,soapserver)
|
PHP_METHOD(soapserver,soapserver)
|
||||||
{
|
{
|
||||||
zval *thisObj;
|
|
||||||
soapServicePtr service;
|
soapServicePtr service;
|
||||||
char *uri;
|
char *uri;
|
||||||
int ret, uri_len;
|
int ret, uri_len;
|
||||||
|
@ -592,8 +565,6 @@ PHP_METHOD(soapserver,soapserver)
|
||||||
php_error(E_ERROR, "Invalid arguments to SoapServer constructor");
|
php_error(E_ERROR, "Invalid arguments to SoapServer constructor");
|
||||||
}
|
}
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
|
||||||
|
|
||||||
service = emalloc(sizeof(soapService));
|
service = emalloc(sizeof(soapService));
|
||||||
memset(service, 0, sizeof(soapService));
|
memset(service, 0, sizeof(soapService));
|
||||||
|
|
||||||
|
@ -604,7 +575,7 @@ PHP_METHOD(soapserver,soapserver)
|
||||||
zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
|
zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||||
|
|
||||||
ret = zend_list_insert(service, le_service);
|
ret = zend_list_insert(service, le_service);
|
||||||
add_property_resource(thisObj, "service", ret);
|
add_property_resource(this_ptr, "service", ret);
|
||||||
zend_list_addref(ret);
|
zend_list_addref(ret);
|
||||||
|
|
||||||
SOAP_SERVER_END_CODE();
|
SOAP_SERVER_END_CODE();
|
||||||
|
@ -906,7 +877,7 @@ PHP_METHOD(soapserver, addfunction)
|
||||||
zend_str_tolower_copy(key, Z_STRVAL_PP(tmp_function), key_len);
|
zend_str_tolower_copy(key, Z_STRVAL_PP(tmp_function), key_len);
|
||||||
|
|
||||||
if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) {
|
if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) {
|
||||||
php_error(E_ERROR, "Tried to add a non existant function (\"%s\")", Z_STRVAL_PP(tmp_function));
|
php_error(E_ERROR, "Tried to add a non existant function '%s'", Z_STRVAL_PP(tmp_function));
|
||||||
}
|
}
|
||||||
|
|
||||||
MAKE_STD_ZVAL(function_copy);
|
MAKE_STD_ZVAL(function_copy);
|
||||||
|
@ -927,7 +898,7 @@ PHP_METHOD(soapserver, addfunction)
|
||||||
zend_str_tolower_copy(key, Z_STRVAL_P(function_name), key_len);
|
zend_str_tolower_copy(key, Z_STRVAL_P(function_name), key_len);
|
||||||
|
|
||||||
if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) {
|
if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) {
|
||||||
php_error(E_ERROR, "Tried to add a non existant function (\"%s\")", Z_STRVAL_P(function_name));
|
php_error(E_ERROR, "Tried to add a non existant function '%s'", Z_STRVAL_P(function_name));
|
||||||
}
|
}
|
||||||
if (service->soap_functions.ft == NULL) {
|
if (service->soap_functions.ft == NULL) {
|
||||||
service->soap_functions.functions_all = FALSE;
|
service->soap_functions.functions_all = FALSE;
|
||||||
|
@ -948,7 +919,7 @@ PHP_METHOD(soapserver, addfunction)
|
||||||
}
|
}
|
||||||
service->soap_functions.functions_all = TRUE;
|
service->soap_functions.functions_all = TRUE;
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Invalid value passed to addfunction (%ld)", Z_LVAL_P(function_name));
|
php_error(E_ERROR, "Invalid value passed to addfunction");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1141,7 +1112,7 @@ PHP_METHOD(soapserver, handle)
|
||||||
call_status = call_user_function(EG(function_table), NULL, &function_name, &retval, num_params, params TSRMLS_CC);
|
call_status = call_user_function(EG(function_table), NULL, &function_name, &retval, num_params, params TSRMLS_CC);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Function (%s) doesn't exist", Z_STRVAL(function_name));
|
php_error(E_ERROR, "Function '%s' doesn't exist", Z_STRVAL(function_name));
|
||||||
}
|
}
|
||||||
efree(fn_name);
|
efree(fn_name);
|
||||||
|
|
||||||
|
@ -1160,7 +1131,7 @@ PHP_METHOD(soapserver, handle)
|
||||||
SOAP_GLOBAL(overrides) = NULL;
|
SOAP_GLOBAL(overrides) = NULL;
|
||||||
efree(response_name);
|
efree(response_name);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Function (%s) call failed", Z_STRVAL(function_name));
|
php_error(E_ERROR, "Function '%s' call failed", Z_STRVAL(function_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
SOAP_GLOBAL(soap_version) = old_soap_version;
|
SOAP_GLOBAL(soap_version) = old_soap_version;
|
||||||
|
@ -1303,15 +1274,12 @@ PHP_METHOD(soapobject, soapobject)
|
||||||
{
|
{
|
||||||
char *location;
|
char *location;
|
||||||
int location_len;
|
int location_len;
|
||||||
zval *thisObj;
|
|
||||||
zval *arg2 = NULL;
|
zval *arg2 = NULL;
|
||||||
long use = SOAP_RPC;
|
long use = SOAP_RPC;
|
||||||
long style = SOAP_ENCODED;
|
long style = SOAP_ENCODED;
|
||||||
long version = SOAP_1_1;
|
long version = SOAP_1_1;
|
||||||
long old_soap_version ;
|
long old_soap_version ;
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zlll", &location, &location_len, &arg2, &style, &use, &version) == SUCCESS) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zlll", &location, &location_len, &arg2, &style, &use, &version) == SUCCESS) {
|
||||||
if (arg2 == NULL || Z_TYPE_P(arg2) == IS_LONG) {
|
if (arg2 == NULL || Z_TYPE_P(arg2) == IS_LONG) {
|
||||||
/* SoapObject($wsdl, $version=SOAP_1_1) */
|
/* SoapObject($wsdl, $version=SOAP_1_1) */
|
||||||
|
@ -1322,7 +1290,7 @@ PHP_METHOD(soapobject, soapobject)
|
||||||
version = Z_LVAL_P(arg2);
|
version = Z_LVAL_P(arg2);
|
||||||
}
|
}
|
||||||
if (version == SOAP_1_1 || version == SOAP_1_2) {
|
if (version == SOAP_1_1 || version == SOAP_1_2) {
|
||||||
add_property_long(thisObj, "_soap_version", version);
|
add_property_long(this_ptr, "_soap_version", version);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Can't create SoapObject. Wrong 'version' parameter.");
|
php_error(E_ERROR,"Can't create SoapObject. Wrong 'version' parameter.");
|
||||||
}
|
}
|
||||||
|
@ -1332,27 +1300,27 @@ PHP_METHOD(soapobject, soapobject)
|
||||||
sdl = get_sdl(location);
|
sdl = get_sdl(location);
|
||||||
ret = zend_list_insert(sdl, le_sdl);
|
ret = zend_list_insert(sdl, le_sdl);
|
||||||
|
|
||||||
add_property_resource(thisObj, "sdl", ret);
|
add_property_resource(this_ptr, "sdl", ret);
|
||||||
zend_list_addref(ret);
|
zend_list_addref(ret);
|
||||||
|
|
||||||
SOAP_GLOBAL(soap_version) = old_soap_version;
|
SOAP_GLOBAL(soap_version) = old_soap_version;
|
||||||
|
|
||||||
} else if (arg2 != NULL && Z_TYPE_P(arg2) == IS_STRING) {
|
} else if (arg2 != NULL && Z_TYPE_P(arg2) == IS_STRING) {
|
||||||
/* SoapObject($location, $uri, $style=SOAP_RPC, $use=SOAP_ENCODED, $version=SOAP_1_1) */
|
/* SoapObject($location, $uri, $style=SOAP_RPC, $use=SOAP_ENCODED, $version=SOAP_1_1) */
|
||||||
add_property_stringl(thisObj, "location", location, location_len, 1);
|
add_property_stringl(this_ptr, "location", location, location_len, 1);
|
||||||
add_property_stringl(thisObj, "uri", Z_STRVAL_P(arg2), Z_STRLEN_P(arg2), 1);
|
add_property_stringl(this_ptr, "uri", Z_STRVAL_P(arg2), Z_STRLEN_P(arg2), 1);
|
||||||
if (style == SOAP_RPC || style == SOAP_DOCUMENT) {
|
if (style == SOAP_RPC || style == SOAP_DOCUMENT) {
|
||||||
add_property_long(thisObj, "style", style);
|
add_property_long(this_ptr, "style", style);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Can't create SoapObject. Wrong 'style' parameter.");
|
php_error(E_ERROR,"Can't create SoapObject. Wrong 'style' parameter.");
|
||||||
}
|
}
|
||||||
if (use == SOAP_ENCODED || use == SOAP_LITERAL) {
|
if (use == SOAP_ENCODED || use == SOAP_LITERAL) {
|
||||||
add_property_long(thisObj, "use", use);
|
add_property_long(this_ptr, "use", use);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Can't create SoapObject. Wrong 'use' parameter.");
|
php_error(E_ERROR,"Can't create SoapObject. Wrong 'use' parameter.");
|
||||||
}
|
}
|
||||||
if (version == SOAP_1_1 || version == SOAP_1_2) {
|
if (version == SOAP_1_1 || version == SOAP_1_2) {
|
||||||
add_property_long(thisObj, "_soap_version", version);
|
add_property_long(this_ptr, "_soap_version", version);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR,"Can't create SoapObject. Wrong 'version' parameter.");
|
php_error(E_ERROR,"Can't create SoapObject. Wrong 'version' parameter.");
|
||||||
}
|
}
|
||||||
|
@ -1365,15 +1333,12 @@ PHP_METHOD(soapobject, soapobject)
|
||||||
PHP_METHOD(soapobject, __trace)
|
PHP_METHOD(soapobject, __trace)
|
||||||
{
|
{
|
||||||
int level;
|
int level;
|
||||||
zval *thisObj;
|
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &level)) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &level)) {
|
||||||
php_error(E_ERROR, "Invalid arguments to SoapObject->__trace");
|
php_error(E_ERROR, "Invalid arguments to SoapObject->__trace");
|
||||||
}
|
}
|
||||||
|
|
||||||
add_property_long(thisObj, "trace", level);
|
add_property_long(this_ptr, "trace", level);
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1453,7 +1418,7 @@ zend_try {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
zval **uri, **location;
|
zval **uri, **location;
|
||||||
smart_str *action;
|
smart_str action = {0};
|
||||||
|
|
||||||
if (zend_hash_find(Z_OBJPROP_P(thisObj), "uri", sizeof("uri"), (void *)&uri) == FAILURE) {
|
if (zend_hash_find(Z_OBJPROP_P(thisObj), "uri", sizeof("uri"), (void *)&uri) == FAILURE) {
|
||||||
add_soap_fault(thisObj, "Client", "Error finding \"uri\" property", NULL, NULL TSRMLS_CC);
|
add_soap_fault(thisObj, "Client", "Error finding \"uri\" property", NULL, NULL TSRMLS_CC);
|
||||||
|
@ -1461,11 +1426,15 @@ zend_try {
|
||||||
add_soap_fault(thisObj, "Client", "Error could not find \"location\" property", NULL, NULL TSRMLS_CC);
|
add_soap_fault(thisObj, "Client", "Error could not find \"location\" property", NULL, NULL TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
request = seralize_function_call(thisObj, NULL, function, Z_STRVAL_PP(uri), real_args, arg_count, soap_version TSRMLS_CC);
|
request = seralize_function_call(thisObj, NULL, function, Z_STRVAL_PP(uri), real_args, arg_count, soap_version TSRMLS_CC);
|
||||||
action = build_soap_action(thisObj, function);
|
|
||||||
ret = send_http_soap_request(thisObj, request, Z_STRVAL_PP(location), action->c, soap_version TSRMLS_CC);
|
|
||||||
|
|
||||||
smart_str_free(action);
|
smart_str_appendl(&action, Z_STRVAL_PP(uri), Z_STRLEN_PP(uri));
|
||||||
efree(action);
|
smart_str_appendc(&action, '#');
|
||||||
|
smart_str_appends(&action, function);
|
||||||
|
smart_str_0(&action);
|
||||||
|
|
||||||
|
ret = send_http_soap_request(thisObj, request, Z_STRVAL_PP(location), action.c, soap_version TSRMLS_CC);
|
||||||
|
|
||||||
|
smart_str_free(&action);
|
||||||
xmlFreeDoc(request);
|
xmlFreeDoc(request);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -1510,15 +1479,13 @@ PHP_METHOD(soapobject, __login)
|
||||||
char *login_pass;
|
char *login_pass;
|
||||||
int login_name_len;
|
int login_name_len;
|
||||||
int login_pass_len;
|
int login_pass_len;
|
||||||
zval* thisObj;
|
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss",
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss",
|
||||||
&login_name, &login_name_len, &login_pass, &login_pass_len) == FAILURE) {
|
&login_name, &login_name_len, &login_pass, &login_pass_len) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GET_THIS_OBJECT(thisObj);
|
add_property_stringl(this_ptr,"_login",login_name,login_name_len, 1);
|
||||||
add_property_stringl(thisObj,"_login",login_name,login_name_len, 1);
|
add_property_stringl(this_ptr,"_password",login_pass,login_pass_len, 1);
|
||||||
add_property_stringl(thisObj,"_password",login_pass,login_pass_len, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1530,7 +1497,6 @@ PHP_METHOD(soapobject, __call)
|
||||||
zval **real_args;
|
zval **real_args;
|
||||||
zval **param;
|
zval **param;
|
||||||
int arg_count;
|
int arg_count;
|
||||||
zval *thisObj;
|
|
||||||
|
|
||||||
HashPosition pos;
|
HashPosition pos;
|
||||||
|
|
||||||
|
@ -1548,19 +1514,14 @@ PHP_METHOD(soapobject, __call)
|
||||||
/*zval_add_ref(param);*/
|
/*zval_add_ref(param);*/
|
||||||
real_args[i++] = *param;
|
real_args[i++] = *param;
|
||||||
}
|
}
|
||||||
GET_THIS_OBJECT(thisObj);
|
do_soap_call(this_ptr, function, function_len, arg_count, real_args, return_value TSRMLS_CC);
|
||||||
do_soap_call(thisObj, function, function_len, arg_count, real_args, return_value TSRMLS_CC);
|
|
||||||
|
|
||||||
efree(real_args);
|
efree(real_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
PHP_METHOD(soapobject, __isfault)
|
PHP_METHOD(soapobject, __isfault)
|
||||||
{
|
{
|
||||||
zval *thisObj;
|
if (zend_hash_exists(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"))) {
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
|
||||||
|
|
||||||
if (zend_hash_exists(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault"))) {
|
|
||||||
RETURN_TRUE
|
RETURN_TRUE
|
||||||
} else {
|
} else {
|
||||||
RETURN_FALSE
|
RETURN_FALSE
|
||||||
|
@ -1569,12 +1530,9 @@ PHP_METHOD(soapobject, __isfault)
|
||||||
|
|
||||||
PHP_METHOD(soapobject, __getfault)
|
PHP_METHOD(soapobject, __getfault)
|
||||||
{
|
{
|
||||||
zval *thisObj;
|
|
||||||
zval **tmp;
|
zval **tmp;
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **)&tmp) == SUCCESS) {
|
||||||
|
|
||||||
if (zend_hash_find(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault"), (void **)&tmp) == SUCCESS) {
|
|
||||||
*return_value = *(*tmp);
|
*return_value = *(*tmp);
|
||||||
zval_copy_ctor(return_value);
|
zval_copy_ctor(return_value);
|
||||||
return;
|
return;
|
||||||
|
@ -1585,11 +1543,8 @@ PHP_METHOD(soapobject, __getfault)
|
||||||
PHP_METHOD(soapobject, __getfunctions)
|
PHP_METHOD(soapobject, __getfunctions)
|
||||||
{
|
{
|
||||||
sdlPtr sdl;
|
sdlPtr sdl;
|
||||||
zval *thisObj;
|
|
||||||
HashPosition pos;
|
HashPosition pos;
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
|
||||||
|
|
||||||
FETCH_THIS_SDL(sdl);
|
FETCH_THIS_SDL(sdl);
|
||||||
|
|
||||||
if (sdl) {
|
if (sdl) {
|
||||||
|
@ -1610,11 +1565,8 @@ PHP_METHOD(soapobject, __getfunctions)
|
||||||
PHP_METHOD(soapobject, __gettypes)
|
PHP_METHOD(soapobject, __gettypes)
|
||||||
{
|
{
|
||||||
sdlPtr sdl;
|
sdlPtr sdl;
|
||||||
zval *thisObj;
|
|
||||||
HashPosition pos;
|
HashPosition pos;
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
|
||||||
|
|
||||||
FETCH_THIS_SDL(sdl);
|
FETCH_THIS_SDL(sdl);
|
||||||
|
|
||||||
if (sdl) {
|
if (sdl) {
|
||||||
|
@ -1636,12 +1588,9 @@ PHP_METHOD(soapobject, __gettypes)
|
||||||
|
|
||||||
PHP_METHOD(soapobject, __getlastrequest)
|
PHP_METHOD(soapobject, __getlastrequest)
|
||||||
{
|
{
|
||||||
zval *thisObj;
|
|
||||||
zval **tmp;
|
zval **tmp;
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request"), (void **)&tmp) == SUCCESS) {
|
||||||
|
|
||||||
if (zend_hash_find(Z_OBJPROP_P(thisObj), "__last_request", sizeof("__last_request"), (void **)&tmp) == SUCCESS) {
|
|
||||||
RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
|
RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
|
||||||
}
|
}
|
||||||
RETURN_NULL();
|
RETURN_NULL();
|
||||||
|
@ -1649,12 +1598,9 @@ PHP_METHOD(soapobject, __getlastrequest)
|
||||||
|
|
||||||
PHP_METHOD(soapobject, __getlastresponse)
|
PHP_METHOD(soapobject, __getlastresponse)
|
||||||
{
|
{
|
||||||
zval *thisObj;
|
|
||||||
zval **tmp;
|
zval **tmp;
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response"), (void **)&tmp) == SUCCESS) {
|
||||||
|
|
||||||
if (zend_hash_find(Z_OBJPROP_P(thisObj), "__last_response", sizeof("__last_response"), (void **)&tmp) == SUCCESS) {
|
|
||||||
RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
|
RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
|
||||||
}
|
}
|
||||||
RETURN_NULL();
|
RETURN_NULL();
|
||||||
|
@ -1665,24 +1611,21 @@ static void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_proper
|
||||||
{
|
{
|
||||||
pval *object = property_reference->object;
|
pval *object = property_reference->object;
|
||||||
zend_overloaded_element *function_name = (zend_overloaded_element *)property_reference->elements_list->tail->data;
|
zend_overloaded_element *function_name = (zend_overloaded_element *)property_reference->elements_list->tail->data;
|
||||||
zval *thisObj;
|
|
||||||
char *function = Z_STRVAL(function_name->element);
|
char *function = Z_STRVAL(function_name->element);
|
||||||
zend_function *builtin_function;
|
zend_function *builtin_function;
|
||||||
|
|
||||||
GET_THIS_OBJECT(thisObj);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Find if the function being called is already defined...
|
Find if the function being called is already defined...
|
||||||
( IMHO: zend should handle this functionality )
|
( IMHO: zend should handle this functionality )
|
||||||
*/
|
*/
|
||||||
if (zend_hash_find(&Z_OBJCE_P(thisObj)->function_table, function, Z_STRLEN(function_name->element) + 1, (void **) &builtin_function) == SUCCESS) {
|
if (zend_hash_find(&Z_OBJCE_P(this_ptr)->function_table, function, Z_STRLEN(function_name->element) + 1, (void **) &builtin_function) == SUCCESS) {
|
||||||
builtin_function->internal_function.handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
builtin_function->internal_function.handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
||||||
} else {
|
} else {
|
||||||
int arg_count = ZEND_NUM_ARGS();
|
int arg_count = ZEND_NUM_ARGS();
|
||||||
zval **arguments = (zval **) emalloc(sizeof(zval *) * arg_count);
|
zval **arguments = (zval **) emalloc(sizeof(zval *) * arg_count);
|
||||||
|
|
||||||
zend_get_parameters_array(ht, arg_count, arguments);
|
zend_get_parameters_array(ht, arg_count, arguments);
|
||||||
do_soap_call(thisObj, function, Z_STRLEN(function_name->element) + 1, arg_count, arguments, return_value TSRMLS_CC);
|
do_soap_call(this_ptr, function, Z_STRLEN(function_name->element) + 1, arg_count, arguments, return_value TSRMLS_CC);
|
||||||
efree(arguments);
|
efree(arguments);
|
||||||
}
|
}
|
||||||
zval_dtor(&function_name->element);
|
zval_dtor(&function_name->element);
|
||||||
|
@ -2138,7 +2081,7 @@ static xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function,
|
||||||
ns = xmlNewNs(envelope, SOAP_1_2_ENV_NAMESPACE, SOAP_1_2_ENV_NS_PREFIX);
|
ns = xmlNewNs(envelope, SOAP_1_2_ENV_NAMESPACE, SOAP_1_2_ENV_NS_PREFIX);
|
||||||
xmlSetNs(envelope,ns);
|
xmlSetNs(envelope,ns);
|
||||||
} else {
|
} else {
|
||||||
php_error(E_ERROR, "Unknown SOAP version");
|
php_error(E_ERROR, "SOAP-ERROR: Unknown SOAP version");
|
||||||
}
|
}
|
||||||
xmlDocSetRootElement(doc, envelope);
|
xmlDocSetRootElement(doc, envelope);
|
||||||
|
|
||||||
|
|
|
@ -15,4 +15,4 @@ test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>4));
|
||||||
echo "ok";
|
echo "ok";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Fatal error: Attribute 'int' has fixed value '5' (value '4' is not allowed) in %stest_schema.inc on line %d
|
Fatal error: SOAP-ERROR: Encoding: Attribute 'int' has fixed value '5' (value '4' is not allowed) in %stest_schema.inc on line %d
|
Loading…
Add table
Add a link
Reference in a new issue