$error = '';
} else {
$success = $result['fault']->faultcode;
+ $pos = strpos($success,':');
+ if ($pos !== false) {
+ $success = substr($success,$pos+1);
+ }
$error = $result['fault']->faultstring;
if (!$wire) $wire= $result['fault']->detail;
}
} else {
$ok = 0;
$res =$fault->faultcode;
+ $pos = strpos($res,':');
+ if ($pos !== false) {
+ $res = substr($res,$pos+1);
+ }
}
// save the wire
$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);
$soap_test->setResult($ok,$res, $wire,$fault->faultstring, $fault);
} else {
$fault = $this->result['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 {
print "<font color=\"#ff0000\">FAILED: ".$this->result['result']."</font>\n";
}
static int is_map(zval *array);
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 set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type);
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) {
- php_error(E_ERROR, "Error calling to_xml_before");
+ php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_xml_before");
}
}
return data;
if (type.map->map_functions.to_xml) {
MAKE_STD_ZVAL(ret);
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) {
- 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) {
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) {
- 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) {
node = (xmlNodePtr)Z_LVAL_PP(addr);
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) {
- 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) {
node = (xmlNodePtr)Z_LVAL_PP(addr);
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) {
- php_error(E_ERROR, "Error calling to_zval");
+ php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_zval");
}
zval_ptr_dtor(¶m);
efree(param);
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) {
- php_error(E_ERROR, "Error calling to_xml_before");
+ php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_zval_after");
}
}
return data;
if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) {
ZVAL_STRING(ret, data->children->content, 1);
} else {
- php_error(E_ERROR,"Violation of encoding rules");
+ php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
}
} else {
ZVAL_EMPTY_STRING(ret);
whiteSpace_replace(data->children->content);
ZVAL_STRING(ret, data->children->content, 1);
} else {
- php_error(E_ERROR,"Violation of encoding rules");
+ php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
}
} else {
ZVAL_EMPTY_STRING(ret);
whiteSpace_collapse(data->children->content);
ZVAL_STRING(ret, data->children->content, 1);
} else {
- php_error(E_ERROR,"Violation of encoding rules");
+ php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
}
} else {
ZVAL_EMPTY_STRING(ret);
whiteSpace_collapse(data->children->content);
ZVAL_DOUBLE(ret, atof(data->children->content));
} else {
- php_error(E_ERROR,"Violation of encoding rules");
+ php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
}
} else {
ZVAL_NULL(ret);
whiteSpace_collapse(data->children->content);
ZVAL_LONG(ret, atol(data->children->content));
} else {
- php_error(E_ERROR,"Violation of encoding rules");
+ php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
}
} else {
ZVAL_NULL(ret);
ret->type = IS_LONG;
}
} else {
- php_error(E_ERROR,"Violation of encoding rules");
+ php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
}
} else {
ZVAL_NULL(ret);
ZVAL_BOOL(ret, 0);
}
} else {
- php_error(E_ERROR,"Violation of encoding rules");
+ php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
}
} else {
ZVAL_NULL(ret);
if (val && val->children && val->children->content) {
str_val = val->children->content;
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) {
str_val = (*attr)->def;
return 1;
} else {
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;
}
encodePtr enc;
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));
dummy = master_to_xml((*attr)->encode, *data, SOAP_LITERAL, xmlParam);
if (dummy->children && dummy->children->content) {
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);
}
flag = 1;
}
} 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 {
flag = 0;
}
}
pos[i] = (pos[i]*10)+(*str-'0');
} 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 {
flag = 0;
}
FOREACHNODE(trav, "item", item) {
xmlKey = get_node(item->children, "key");
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");
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);
} else if (Z_TYPE_P(key) == IS_LONG) {
zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL_P(key), &value, sizeof(zval *), NULL);
} 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);
}
} else {
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) {
}
smart_str_appends(&list, dummy->children->content);
} else {
- php_error(E_ERROR,"Violation of encoding rules");
+ php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
}
xmlUnlinkNode(dummy);
xmlFreeNode(dummy);
}
smart_str_appends(&list, dummy->children->content);
} else {
- php_error(E_ERROR,"Violation of encoding rules");
+ php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules");
}
xmlUnlinkNode(dummy);
xmlFreeNode(dummy);
}
if (type->restrictions->enumeration) {
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 &&
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 &&
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 &&
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'");
}
}
*/
if (type->restrictions && Z_TYPE_P(data) == IS_STRING) {
if (type->restrictions->enumeration) {
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 &&
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 &&
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 &&
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'");
}
}
}
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)
{
set_ns_and_type_ex(node, type->ns, type->type_str);
TSRMLS_FETCH();
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)) {
zval **ztype;
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);
} else if (Z_TYPE_PP(tmp) == IS_ARRAY && is_map(*tmp)) {
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)
{
soapMappingPtr map = (soapMappingPtr)data;
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 */
xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr parent);
zval *master_to_zval(encodePtr encode, xmlNodePtr data);
php_url *phpurl = NULL;
php_stream *stream;
zval **trace, **tmp;
+ int old_error_reporting;
if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) {
return FALSE;
xmlDocDumpMemory(doc, &buf, &buf_size);
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;
}
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
}
if (phpurl == NULL) {
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;
}
if (use_ssl && php_stream_locate_url_wrapper("https://", NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) == NULL) {
xmlFree(buf);
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;
}
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,
ENFORCE_SAFE_MODE | REPORT_ERRORS,
STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
NULL /*persistent_id*/,
NULL /*timeout*/,
NULL, NULL, NULL);
+ EG(error_reporting) = old_error_reporting;
efree(res);
}
#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);
+ EG(error_reporting) = old_error_reporting;
if (use_ssl) {
if (FAILURE == php_stream_sock_ssl_activate(stream, 1)) {
xmlFree(buf);
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;
}
}
} else {
xmlFree(buf);
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;
}
}
smart_str_free(&soap_headers);
php_stream_close(stream);
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;
}
smart_str_free(&soap_headers);
if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
php_stream_close(stream);
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;
}
if (http_status >= 200 && http_status < 300) {
} 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) {
- 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) {
- 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) {
- 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) {
- 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) {
- 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) {
- 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) {
- 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 {
- 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);
}
*/
if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
php_stream_close(stream);
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;
}
}
if (!get_http_body(stream, http_headers, &http_body, &http_body_size TSRMLS_CC)) {
php_stream_close(stream);
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;
}
zval *err;
MAKE_STD_ZVAL(err);
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(http_headers);
efree(http_body);
http_buf[size] = '\0';
efree(content_length);
} else {
- php_error(E_ERROR, "Don't know how to read http body, No Content-Length or chunked data");
return FALSE;
}
}
}
add_assoc_zval(return_value, param->paramName, tmp);
- /*add_assoc_zval(return_value, (char*)val->name, tmp);*/
param_count++;
doc = xmlParseFile(location);
xmlCleanupParser();
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");
if (schema == NULL) {
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");
if (import) {
if (ns != NULL && (new_tns == NULL || strcmp(ns->children->content,new_tns->children->content) != 0)) {
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) {
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 {
new_tns = get_attribute(schema->properties, "targetNamespace");
}
} else if (tns != NULL && strcmp(tns->children->content,new_tns->children->content) != 0) {
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);
location = get_attribute(trav->properties, "schemaLocation");
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 {
xmlChar *uri;
xmlChar *base = xmlNodeGetBase(trav->doc, trav);
location = get_attribute(trav->properties, "schemaLocation");
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 {
xmlChar *uri;
xmlChar *base = xmlNodeGetBase(trav->doc, trav);
location = get_attribute(trav->properties, "schemaLocation");
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) {
xmlChar *base = xmlNodeGetBase(trav->doc, trav);
} else if (node_is_equal(trav,"annotation")) {
/* TODO: <annotation> support */
} 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;
}
create_encoder(sdl, cur_type, ns->children->content, name->children->content);
} 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;
schema_union(sdl, tsn, trav, cur_type);
trav = trav->next;
} 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 {
- 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) {
- 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;
sdlTypePtr newType, *tmp;
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));
trav = trav->next;
}
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;
}
sdlTypePtr newType, *tmp;
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));
schema_simpleType(sdl, tsn, trav, newType);
} 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;
}
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;
}
schema_extension_simpleContent(sdl, tsn, trav, cur_type);
trav = trav->next;
} 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 {
- 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) {
- 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;
if (type) {efree(type);}
if (ns) {efree(ns);}
} 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) {
trav = trav->next;
break;
} 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;
}
}
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;
if (type) {efree(type);}
if (ns) {efree(ns);}
} 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 = trav->next;
break;
} 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;
}
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;
value = get_attribute(val->properties, "value");
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);
value = get_attribute(val->properties, "value");
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);
if (type) {efree(type);}
if (ns) {efree(ns);}
} 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 = trav->next;
break;
} 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;
}
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;
}
if (type) {efree(type);}
if (ns) {efree(ns);}
} 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 = trav->next;
break;
} 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;
}
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;
}
if (node_is_equal(trav,"element")) {
schema_element(sdl, tsn, trav, cur_type, newModel);
} 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;
}
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) {
- 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;
zend_hash_next_index_insert(model->u.content, &newModel, sizeof(sdlContentModelPtr), NULL);
}
} 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;
if (trav != NULL) {
if (node_is_equal(trav,"choice")) {
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;
schema_choice(sdl, tsn, trav, cur_type, newModel);
trav = trav->next;
} else if (node_is_equal(trav,"sequence")) {
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;
schema_sequence(sdl, tsn, trav, cur_type, newModel);
trav = trav->next;
} else if (node_is_equal(trav,"all")) {
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;
schema_all(sdl, tsn, trav, cur_type, newModel);
trav = trav->next;
} 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) {
- 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;
}
} else if (node_is_equal(trav,"any")) {
schema_any(sdl, tsn, trav, cur_type, newModel);
} 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;
}
} else if (node_is_equal(trav,"any")) {
schema_any(sdl, tsn, trav, cur_type, newModel);
} 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;
}
schema_extension_complexContent(sdl, tsn, trav, cur_type);
trav = trav->next;
} 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 {
- 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) {
- 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;
cur_type = (*ptr);
create_encoder(sdl, cur_type, ns->children->content, name->children->content);
} 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;
}
trav = trav->next;
break;
} 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;
}
}
}
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;
}
smart_str_0(&key);
if (zend_hash_add(addHash, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
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 {
zend_hash_next_index_insert(addHash, &newType, sizeof(sdlTypePtr), NULL);
}
}
cur_type = newType;
} 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 */
attr = get_attribute(attrs, "nillable");
if (attr) {
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") ||
!stricmp(attr->children->content, "1")) {
attr = get_attribute(attrs, "fixed");
if (attr) {
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);
}
attr = get_attribute(attrs, "default");
if (attr) {
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) {
- 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);
}
xmlNsPtr nsptr;
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);
nsptr = xmlSearchNs(element->doc, element, str_ns);
if (trav != NULL) {
if (node_is_equal(trav,"simpleType")) {
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) {
- 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);
trav = trav->next;
} else if (node_is_equal(trav,"complexType")) {
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) {
- 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);
trav = trav->next;
} else if (node_is_equal(trav,"key")) {
/* TODO: <keyref> support */
} 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;
}
}
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);
} 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 */
xmlNsPtr nsptr;
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);
nsptr = xmlSearchNs(attrType->doc, attrType, str_ns);
if (node_is_equal(trav,"simpleType")) {
sdlTypePtr dummy_type;
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) {
- 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));
memset(dummy_type, 0, sizeof(sdlType));
}
}
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;
}
smart_str_0(&key);
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;
smart_str_free(&key);
cur_type = NULL;
}
} 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;
while (trav != NULL) {
if (node_is_equal(trav,"attribute")) {
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);
} else if (node_is_equal(trav,"attributeGroup")) {
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);
} else if (node_is_equal(trav,"anyAttribute")) {
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 */
trav = trav->next;
break;
} 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;
}
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;
}
model->kind = XSD_CONTENT_GROUP;
model->u.group = (*tmp)->model;
} 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;
}
type->encode = (*tmp)->encode;
/* TODO: nillable */
} 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);
int schema_pass3(sdlPtr sdl)
{
-/*
- if (sdl->elements) {
- zend_hash_destroy(sdl->elements);
- free(sdl->elements);
- sdl->elements = NULL;
- }
-*/
if (sdl->attributes) {
zend_hash_destroy(sdl->attributes);
free(sdl->attributes);
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);
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) {
xmlAttrPtr name = get_attribute(trav->properties, "name");
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) {
- 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 {
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <message> hasn't name attribute");
xmlAttrPtr name = get_attribute(trav->properties, "name");
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) {
- 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 {
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <portType> hasn't name attribute");
xmlAttrPtr name = get_attribute(trav->properties, "name");
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) {
- 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 {
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <binding> hasn't name attribute");
xmlAttrPtr name = get_attribute(trav->properties, "name");
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) {
- 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 {
php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <service> hasn't name attribute");
bindingAttr = get_attribute(port->properties, "binding");
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 */
address = get_node(port->children, "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");
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);
parse_namespace(bindingAttr->children->content, &ctype, &ns);
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;
name = get_attribute(binding->properties, "name");
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);
type = get_attribute(binding->properties, "type");
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);
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;
op_name = get_attribute(operation->properties, "name");
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);
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));
if (portTypeInput) {
message = get_attribute(portTypeInput->properties, "message");
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");
parse_namespace(message->children->content, &ctype, &ns);
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;
name = get_attribute(part->properties, "name");
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);
message = get_attribute(portTypeOutput->properties, "message");
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);
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;
name = get_attribute(part->properties, "name");
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);
zend_hash_move_forward(&ctx.services);
}
} 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);
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)
{
char *found = strchr(inval, ':');
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);
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);
void *php_stream_xmlIO_open_wrapper(const char *filename);
if (ZEND_NUM_ARGS() != 0) \
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) \
{ \
- zval *__thisObj,**__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_SDL_PROPERTY(__thisObj,__tmp) != FAILURE) { \
+ zval **__tmp; \
+ if(FIND_SDL_PROPERTY(this_ptr,__tmp) != FAILURE) { \
FETCH_SDL_RES(ss,__tmp); \
} else { \
ss = NULL; \
#define FETCH_THIS_SERVICE(ss) \
{ \
- zval *__thisObj,**__tmp; \
- GET_THIS_OBJECT(__thisObj) \
- if(FIND_SERVICE_PROPERTY(__thisObj,__tmp) != FAILURE) { \
- FETCH_SERVICE_RES(ss,__tmp); \
+ zval **tmp; \
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr),"service", sizeof("service"), (void **)&tmp) != FAILURE) { \
+ ss = (soapServicePtr)zend_fetch_resource(tmp TSRMLS_CC, -1, "service", NULL, 1, le_service); \
} else { \
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_server_class_entry;
static zend_class_entry* soap_fault_class_entry;
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)
{
zend_error_cb = old_error_handler;
zend_class_entry ce;
/* 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 */
xmlRegisterDefaultInputCallbacks();
/* SoapParam functions */
PHP_METHOD(soapparam,soapparam)
{
- zval *thisObj, *data;
+ zval *data;
char *name;
int name_length;
php_error(E_ERROR, "Invalid arguments to SoapParam constructor");
}
- GET_THIS_OBJECT(thisObj);
-
#ifndef ZEND_ENGINE_2
zval_add_ref(&data);
#endif
- add_property_stringl(thisObj, "param_name", name, name_length, 1);
- add_property_zval(thisObj, "param_data", data);
+ add_property_stringl(this_ptr, "param_name", name, name_length, 1);
+ add_property_zval(this_ptr, "param_data", data);
}
/* SoapFault functions */
{
char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL;
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",
&fault_code, &fault_code_len,
php_error(E_ERROR, "Invalid arguments to SoapFault constructor");
}
- GET_THIS_OBJECT(thisObj);
-
- set_soap_fault(thisObj, fault_code, fault_string, fault_actor, details TSRMLS_CC);
+ set_soap_fault(this_ptr, fault_code, fault_string, fault_actor, details TSRMLS_CC);
}
/* SoapVar functions */
PHP_METHOD(soapvar,soapvar)
{
- zval *data, *thisObj, *type;
+ zval *data, *type;
char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL;
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) {
php_error(E_ERROR, "Invalid arguments to SoapVar constructor");
}
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 {
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 {
- php_error(E_ERROR, "Cannot find encoding for SoapVar");
+ php_error(E_ERROR, "Invalid type ID to SoapVar constructor");
}
}
#ifndef ZEND_ENGINE_2
zval_add_ref(&data);
#endif
- add_property_zval(thisObj, "enc_value", data);
+ add_property_zval(this_ptr, "enc_value", data);
}
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) {
- 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) {
- 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) {
- add_property_stringl(thisObj, "enc_namens", namens, namens_len, 1);
+ add_property_stringl(this_ptr, "enc_namens", namens, namens_len, 1);
}
}
/* SoapServer functions */
PHP_METHOD(soapserver,soapserver)
{
- zval *thisObj;
soapServicePtr service;
char *uri;
int ret, uri_len;
php_error(E_ERROR, "Invalid arguments to SoapServer constructor");
}
- GET_THIS_OBJECT(thisObj);
-
service = emalloc(sizeof(soapService));
memset(service, 0, sizeof(soapService));
zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
ret = zend_list_insert(service, le_service);
- add_property_resource(thisObj, "service", ret);
+ add_property_resource(this_ptr, "service", ret);
zend_list_addref(ret);
SOAP_SERVER_END_CODE();
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) {
- 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);
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) {
- 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) {
service->soap_functions.functions_all = FALSE;
}
service->soap_functions.functions_all = TRUE;
} 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");
}
}
call_status = call_user_function(EG(function_table), NULL, &function_name, &retval, num_params, params TSRMLS_CC);
}
} 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);
SOAP_GLOBAL(overrides) = NULL;
efree(response_name);
} 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;
{
char *location;
int location_len;
- zval *thisObj;
zval *arg2 = NULL;
long use = SOAP_RPC;
long style = SOAP_ENCODED;
long version = SOAP_1_1;
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 (arg2 == NULL || Z_TYPE_P(arg2) == IS_LONG) {
/* SoapObject($wsdl, $version=SOAP_1_1) */
version = Z_LVAL_P(arg2);
}
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 {
php_error(E_ERROR,"Can't create SoapObject. Wrong 'version' parameter.");
}
sdl = get_sdl(location);
ret = zend_list_insert(sdl, le_sdl);
- add_property_resource(thisObj, "sdl", ret);
+ add_property_resource(this_ptr, "sdl", ret);
zend_list_addref(ret);
SOAP_GLOBAL(soap_version) = old_soap_version;
} else if (arg2 != NULL && Z_TYPE_P(arg2) == IS_STRING) {
/* 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(thisObj, "uri", Z_STRVAL_P(arg2), Z_STRLEN_P(arg2), 1);
+ add_property_stringl(this_ptr, "location", location, location_len, 1);
+ add_property_stringl(this_ptr, "uri", Z_STRVAL_P(arg2), Z_STRLEN_P(arg2), 1);
if (style == SOAP_RPC || style == SOAP_DOCUMENT) {
- add_property_long(thisObj, "style", style);
+ add_property_long(this_ptr, "style", style);
} else {
php_error(E_ERROR,"Can't create SoapObject. Wrong 'style' parameter.");
}
if (use == SOAP_ENCODED || use == SOAP_LITERAL) {
- add_property_long(thisObj, "use", use);
+ add_property_long(this_ptr, "use", use);
} else {
php_error(E_ERROR,"Can't create SoapObject. Wrong 'use' parameter.");
}
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 {
php_error(E_ERROR,"Can't create SoapObject. Wrong 'version' parameter.");
}
PHP_METHOD(soapobject, __trace)
{
int level;
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &level)) {
php_error(E_ERROR, "Invalid arguments to SoapObject->__trace");
}
- add_property_long(thisObj, "trace", level);
+ add_property_long(this_ptr, "trace", level);
RETURN_TRUE;
}
}
} else {
zval **uri, **location;
- smart_str *action;
+ smart_str action = {0};
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 could not find \"location\" property", NULL, NULL TSRMLS_CC);
} else {
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);
- efree(action);
+ smart_str_appendl(&action, Z_STRVAL_PP(uri), Z_STRLEN_PP(uri));
+ 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);
if (ret) {
char *login_pass;
int login_name_len;
int login_pass_len;
- zval* thisObj;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss",
&login_name, &login_name_len, &login_pass, &login_pass_len) == FAILURE) {
return;
}
- GET_THIS_OBJECT(thisObj);
- add_property_stringl(thisObj,"_login",login_name,login_name_len, 1);
- add_property_stringl(thisObj,"_password",login_pass,login_pass_len, 1);
+ add_property_stringl(this_ptr,"_login",login_name,login_name_len, 1);
+ add_property_stringl(this_ptr,"_password",login_pass,login_pass_len, 1);
}
zval **real_args;
zval **param;
int arg_count;
- zval *thisObj;
HashPosition pos;
/*zval_add_ref(param);*/
real_args[i++] = *param;
}
- GET_THIS_OBJECT(thisObj);
- do_soap_call(thisObj, function, function_len, arg_count, real_args, return_value TSRMLS_CC);
+ do_soap_call(this_ptr, function, function_len, arg_count, real_args, return_value TSRMLS_CC);
efree(real_args);
}
PHP_METHOD(soapobject, __isfault)
{
- zval *thisObj;
-
- GET_THIS_OBJECT(thisObj);
-
- if (zend_hash_exists(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault"))) {
+ if (zend_hash_exists(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"))) {
RETURN_TRUE
} else {
RETURN_FALSE
PHP_METHOD(soapobject, __getfault)
{
- zval *thisObj;
zval **tmp;
- GET_THIS_OBJECT(thisObj);
-
- if (zend_hash_find(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault"), (void **)&tmp) == SUCCESS) {
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **)&tmp) == SUCCESS) {
*return_value = *(*tmp);
zval_copy_ctor(return_value);
return;
PHP_METHOD(soapobject, __getfunctions)
{
sdlPtr sdl;
- zval *thisObj;
HashPosition pos;
- GET_THIS_OBJECT(thisObj);
-
FETCH_THIS_SDL(sdl);
if (sdl) {
PHP_METHOD(soapobject, __gettypes)
{
sdlPtr sdl;
- zval *thisObj;
HashPosition pos;
- GET_THIS_OBJECT(thisObj);
-
FETCH_THIS_SDL(sdl);
if (sdl) {
PHP_METHOD(soapobject, __getlastrequest)
{
- zval *thisObj;
zval **tmp;
- GET_THIS_OBJECT(thisObj);
-
- if (zend_hash_find(Z_OBJPROP_P(thisObj), "__last_request", sizeof("__last_request"), (void **)&tmp) == SUCCESS) {
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request"), (void **)&tmp) == SUCCESS) {
RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
}
RETURN_NULL();
PHP_METHOD(soapobject, __getlastresponse)
{
- zval *thisObj;
zval **tmp;
- GET_THIS_OBJECT(thisObj);
-
- if (zend_hash_find(Z_OBJPROP_P(thisObj), "__last_response", sizeof("__last_response"), (void **)&tmp) == SUCCESS) {
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response"), (void **)&tmp) == SUCCESS) {
RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
}
RETURN_NULL();
{
pval *object = property_reference->object;
zend_overloaded_element *function_name = (zend_overloaded_element *)property_reference->elements_list->tail->data;
- zval *thisObj;
char *function = Z_STRVAL(function_name->element);
zend_function *builtin_function;
- GET_THIS_OBJECT(thisObj);
-
/*
Find if the function being called is already defined...
( 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);
} else {
int arg_count = ZEND_NUM_ARGS();
zval **arguments = (zval **) emalloc(sizeof(zval *) * arg_count);
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);
}
zval_dtor(&function_name->element);
ns = xmlNewNs(envelope, SOAP_1_2_ENV_NAMESPACE, SOAP_1_2_ENV_NS_PREFIX);
xmlSetNs(envelope,ns);
} else {
- php_error(E_ERROR, "Unknown SOAP version");
+ php_error(E_ERROR, "SOAP-ERROR: Unknown SOAP version");
}
xmlDocSetRootElement(doc, envelope);
echo "ok";
?>
--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
\ No newline at end of file