summaryrefslogtreecommitdiff
path: root/ext/soap/php_packet_soap.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2004-02-02 16:19:39 +0000
committerDmitry Stogov <dmitry@php.net>2004-02-02 16:19:39 +0000
commit840526f1d3709a62427b4ce46dd8ebaca25e8886 (patch)
tree24c41f3bb639328d796af2a2cafbc3d76a3c78d9 /ext/soap/php_packet_soap.c
parentc9941f9d20fc539567c6891bfbabd5851c5aab7b (diff)
downloadphp-git-840526f1d3709a62427b4ce46dd8ebaca25e8886.tar.gz
Server-part support for SOAP Headers was implemented (incomplete)
Diffstat (limited to 'ext/soap/php_packet_soap.c')
-rw-r--r--ext/soap/php_packet_soap.c61
1 files changed, 52 insertions, 9 deletions
diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c
index 03315c586d..7792c1cd91 100644
--- a/ext/soap/php_packet_soap.c
+++ b/ext/soap/php_packet_soap.c
@@ -86,10 +86,16 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
add_soap_fault(this_ptr, "Client", "A SOAP Envelope element cannot have non Namespace qualified attributes", NULL, NULL TSRMLS_CC);
xmlFreeDoc(response);
return FALSE;
- } else if (soap_version == SOAP_1_2 && attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
- add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Envelope", NULL, NULL TSRMLS_CC);
- xmlFreeDoc(response);
- return FALSE;
+ } else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
+ if (soap_version == SOAP_1_2) {
+ add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Envelope", NULL, NULL TSRMLS_CC);
+ xmlFreeDoc(response);
+ return FALSE;
+ } else if (strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) {
+ add_soap_fault(this_ptr, "Client", "Unknown data encoding style", NULL, NULL TSRMLS_CC);
+ xmlFreeDoc(response);
+ return FALSE;
+ }
}
attr = attr->next;
}
@@ -122,11 +128,26 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
xmlFreeDoc(response);
return FALSE;
}
- attr = get_attribute_ex(body->properties,"encodingStyle",SOAP_1_2_ENV_NAMESPACE);
- if (attr && soap_version == SOAP_1_2) {
- add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Body", NULL, NULL TSRMLS_CC);
- xmlFreeDoc(response);
- return FALSE;
+ attr = body->properties;
+ while (attr != NULL) {
+ if (attr->ns == NULL) {
+ if (soap_version == SOAP_1_2) {
+ add_soap_fault(this_ptr, "Client", "A SOAP Body element cannot have non Namespace qualified attributes", NULL, NULL TSRMLS_CC);
+ xmlFreeDoc(response);
+ return FALSE;
+ }
+ } else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
+ if (soap_version == SOAP_1_2) {
+ add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Body", NULL, NULL TSRMLS_CC);
+ xmlFreeDoc(response);
+ return FALSE;
+ } else if (strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) {
+ add_soap_fault(this_ptr, "Client", "Unknown data encoding style", NULL, NULL TSRMLS_CC);
+ xmlFreeDoc(response);
+ return FALSE;
+ }
+ }
+ attr = attr->next;
}
if (trav != NULL && soap_version == SOAP_1_2) {
add_soap_fault(this_ptr, "Client", "A SOAP 1.2 envelope can contain only Header and Body", NULL, NULL TSRMLS_CC);
@@ -134,6 +155,28 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
return FALSE;
}
+ if (head != NULL) {
+ attr = head->properties;
+ while (attr != NULL) {
+ if (attr->ns == NULL) {
+ add_soap_fault(this_ptr, "Client", "A SOAP Header element cannot have non Namespace qualified attributes", NULL, NULL TSRMLS_CC);
+ xmlFreeDoc(response);
+ return FALSE;
+ } else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
+ if (soap_version == SOAP_1_2) {
+ add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Header", NULL, NULL TSRMLS_CC);
+ xmlFreeDoc(response);
+ return FALSE;
+ } else if (strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) {
+ add_soap_fault(this_ptr, "Client", "Unknown data encoding style", NULL, NULL TSRMLS_CC);
+ xmlFreeDoc(response);
+ return FALSE;
+ }
+ }
+ attr = attr->next;
+ }
+ }
+
/* Check if <Body> contains <Fault> element */
fault = get_node_ex(body->children,"Fault",envelope_ns);
if (fault != NULL) {