diff options
author | Dmitry Stogov <dmitry@php.net> | 2004-01-26 16:19:29 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2004-01-26 16:19:29 +0000 |
commit | 9387d78fd05771971d3831ab45f52b1945fd3ed0 (patch) | |
tree | 42497d1b475f181b777ec73a584e7c3c36fd2a2a /ext/soap/php_packet_soap.c | |
parent | 6fe26e966d2e44992050debad15b79109356aefd (diff) | |
download | php-git-9387d78fd05771971d3831ab45f52b1945fd3ed0.tar.gz |
SOAP 1.2 Fault support (Code,Reason,Datail instead of faultcode,faultstring,...)
Diffstat (limited to 'ext/soap/php_packet_soap.c')
-rw-r--r-- | ext/soap/php_packet_soap.c | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c index 327597ca0a..9bc874efeb 100644 --- a/ext/soap/php_packet_soap.c +++ b/ext/soap/php_packet_soap.c @@ -8,6 +8,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction xmlNodePtr trav, env, head, body, resp, cur, fault; int param_count = 0; int old_error_reporting; + int soap_version; ZVAL_NULL(return_value); @@ -37,9 +38,11 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction if (env == NULL && node_is_equal_ex(trav,"Envelope",SOAP_1_1_ENV_NAMESPACE)) { env = trav; envelope_ns = SOAP_1_1_ENV_NAMESPACE; + soap_version = SOAP_1_1; } else if (env == NULL && node_is_equal_ex(trav,"Envelope",SOAP_1_2_ENV_NAMESPACE)) { env = trav; envelope_ns = SOAP_1_2_ENV_NAMESPACE; + soap_version = SOAP_1_2; } else { add_soap_fault(this_ptr, "Client", "looks like we got bad SOAP response\n", NULL, NULL TSRMLS_CC); xmlFreeDoc(response); @@ -92,26 +95,42 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction zval *details = NULL; xmlNodePtr tmp; - tmp = get_node(fault->children,"faultcode"); - if (tmp != NULL && tmp->children != NULL) { - faultcode = tmp->children->content; - } + if (soap_version == SOAP_1_1) { + tmp = get_node(fault->children,"faultcode"); + if (tmp != NULL && tmp->children != NULL) { + faultcode = tmp->children->content; + } - tmp = get_node(fault->children,"faultstring"); - if (tmp != NULL && tmp->children != NULL) { - faultstring = tmp->children->content; - } + tmp = get_node(fault->children,"faultstring"); + if (tmp != NULL && tmp->children != NULL) { + faultstring = tmp->children->content; + } - tmp = get_node(fault->children,"faultactor"); - if (tmp != NULL && tmp->children != NULL) { - faultactor = tmp->children->content; - } + tmp = get_node(fault->children,"faultactor"); + if (tmp != NULL && tmp->children != NULL) { + faultactor = tmp->children->content; + } - tmp = get_node(fault->children,"detail"); - if (tmp != NULL) { - details = master_to_zval(NULL, tmp); - } + tmp = get_node(fault->children,"detail"); + if (tmp != NULL) { + details = master_to_zval(NULL, tmp); + } + } else { + tmp = get_node(fault->children,"Code"); + if (tmp != NULL && tmp->children != NULL) { + faultcode = tmp->children->content; + } + tmp = get_node(fault->children,"Reason"); + if (tmp != NULL && tmp->children != NULL) { + faultstring = tmp->children->content; + } + + tmp = get_node(fault->children,"Detail"); + if (tmp != NULL) { + details = master_to_zval(NULL, tmp); + } + } add_soap_fault(this_ptr, faultcode, faultstring, faultactor, details TSRMLS_CC); xmlFreeDoc(response); return FALSE; |