]> granicus.if.org Git - php/commitdiff
Server-part support for SOAP Headers was implemented (incomplete)
authorDmitry Stogov <dmitry@php.net>
Mon, 2 Feb 2004 16:19:39 +0000 (16:19 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 2 Feb 2004 16:19:39 +0000 (16:19 +0000)
40 files changed:
ext/soap/TODO
ext/soap/php_packet_soap.c
ext/soap/php_soap.h
ext/soap/soap.c
ext/soap/tests/soap12/T01.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T02.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T03.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T04.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T05.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T10.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T11.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T12.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T13.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T14.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T15.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T19.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T22.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T23.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T26.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T29.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T30.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T32.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T33.phpt
ext/soap/tests/soap12/T34.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T35.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T36.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T37.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T38_1.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T38_2.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T39.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T40.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T66.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T67.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T68.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T73.phpt
ext/soap/tests/soap12/T74.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T78.phpt [new file with mode: 0644]
ext/soap/tests/soap12/T80.phpt [new file with mode: 0644]
ext/soap/tests/soap12/soap12-test.inc
ext/soap/tests/soap12/soap12-test.wsdl

index 537c327446cf4334886473b5dc52e1505a8a47af..6db1d4a241951360ae3dc815ad1b31e23fea94bb 100644 (file)
@@ -9,9 +9,9 @@ General
 
 SOAP
 ----
-- support for SOAP headers
-  - actor attribute
-  - mustUnderstend attribute
+? support for SOAP headers
+  ? actor attribute
+  ? mustUnderstend attribute
 - root attribute
 - make sure soap 1.1 and 1.2 are supported fully
 
@@ -55,7 +55,7 @@ WSDL
 - support for portType operation parameterOrder attribute
 - support for binding operation input/output name attribute (part of overloading)
 - support for <opperation> <fault>
-? support for style "document" encoding (server part)
+? server part support for "document" style encoding
 - function/method overloading/redeclaration (test(int); test(string))
 - wsdl caching
 - wsdl auto generation
index 03315c586d11f971b7bec03f0835af86b90b31e9..7792c1cd9103d32f88d90514c32cfaebc7f2e1c8 100644 (file)
@@ -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) {
index f39692b015d432c80750c3ed152ebf589c5d2b56..c429c314f4b155c884eff9158b40f6d523678214 100644 (file)
@@ -73,20 +73,6 @@ typedef struct _soapService soapService, *soapServicePtr;
 #include "php_http.h"
 #include "php_packet_soap.h"
 
-struct _soapHeaderHandler {
-       char *ns;
-       int type;
-
-       struct _function_handler {
-               char *functionName;
-               char *type;
-       } function_handler;
-
-       struct _class_handler {
-               zend_class_entry *ce;
-       } class_handler;
-};
-
 struct _soapMapping {
        char *ns;
        char *ctype;
@@ -123,8 +109,9 @@ struct _soapService {
        } soap_class;
 
        HashTable *mapping;
-       int type;
-       char *uri;
+       int        type;
+       char      *actor;
+       char      *uri;
 };
 
 #define SOAP_CLASS 1
index ae58cf683c90407261401a5d691e776e571ab0b6..64d01f8fcf3782e9769783cdcf7ea1b83ff77db7 100644 (file)
@@ -29,19 +29,30 @@ static int le_sdl = 0;
 static int le_url = 0;
 static int le_service = 0;
 
+typedef struct _soapHeader {
+       sdlFunctionPtr       function;
+       zval                 function_name;
+       int                  mustUnderstand;
+       int                  num_params;
+       zval               **parameters;
+       zval                 retval;
+       struct _soapHeader  *next;
+} soapHeader;
+
 /* Local functions */
 static void function_to_string(sdlFunctionPtr function, smart_str *buf);
 static void type_to_string(sdlTypePtr type, smart_str *buf, int level);
 
 static void clear_soap_fault(zval *obj TSRMLS_DC);
 static void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC);
+static void soap_server_fault(char* code, char* string, char *actor, zval* details);
 
 static sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int);
 static sdlFunctionPtr get_function(sdlPtr sdl, const char *function_name);
 static sdlFunctionPtr get_doc_function(sdlPtr sdl, xmlNodePtr node);
 
-static void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *function_name, int *num_params, zval **parameters[], int *version TSRMLS_DC);
-static xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_name,char *uri,zval *ret, int version TSRMLS_DC);
+static sdlFunctionPtr deseralize_function_call(sdlPtr sdl, xmlDocPtr request, char* actor, zval *function_name, int *num_params, zval **parameters[], int *version, soapHeader **headers TSRMLS_DC);
+static xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_name,char *uri,zval *ret, soapHeader *headers, int version TSRMLS_DC);
 static xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *function_name, char *uri, zval **arguments, int arg_count, int version TSRMLS_DC);
 static xmlNodePtr seralize_parameter(sdlParamPtr param,zval *param_val,int index,char *name, int style, xmlNodePtr parent TSRMLS_DC);
 static xmlNodePtr seralize_zval(zval *val, sdlParamPtr param, char *paramName, int style, xmlNodePtr parent TSRMLS_DC);
@@ -580,12 +591,12 @@ PHP_METHOD(soapvar,soapvar)
 PHP_METHOD(soapserver,soapserver)
 {
        soapServicePtr service;
-       char *uri;
-       int ret, uri_len;
+       char *uri, *actor = NULL;
+       int ret, uri_len, actor_len;
 
        SOAP_SERVER_BEGIN_CODE();
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uri, &uri_len) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &uri, &uri_len, &actor, &actor_len) == FAILURE) {
                php_error(E_ERROR, "Invalid arguments to SoapServer constructor");
        }
 
@@ -593,6 +604,9 @@ PHP_METHOD(soapserver,soapserver)
        memset(service, 0, sizeof(soapService));
 
        service->uri = estrndup(uri, uri_len);
+       if (actor) {
+               service->actor = estrndup(actor, actor_len);
+       }
        service->type = SOAP_FUNCTIONS;
        service->soap_functions.functions_all = FALSE;
        service->soap_functions.ft = emalloc(sizeof(HashTable));
@@ -961,6 +975,7 @@ PHP_METHOD(soapserver, handle)
        int num_params = 0, size, i, call_status = 0;
        xmlChar *buf;
        HashTable *function_table;
+       soapHeader *soap_headers;
 
        SOAP_SERVER_BEGIN_CODE();
 
@@ -1033,6 +1048,8 @@ PHP_METHOD(soapserver, handle)
        if (zend_hash_find(&EG(symbol_table), HTTP_RAW_POST_DATA, sizeof(HTTP_RAW_POST_DATA), (void **) &raw_post)!=FAILURE
                && ((*raw_post)->type==IS_STRING)) {
                int old_error_reporting = EG(error_reporting);
+               sdlFunctionPtr function;
+
                EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
 
                doc_request = xmlParseMemory(Z_STRVAL_PP(raw_post),Z_STRLEN_PP(raw_post));
@@ -1050,7 +1067,7 @@ PHP_METHOD(soapserver, handle)
                old_sdl = SOAP_GLOBAL(sdl);
                SOAP_GLOBAL(sdl) = service->sdl;
                old_soap_version = SOAP_GLOBAL(soap_version);
-               deseralize_function_call(service->sdl, doc_request, &function_name, &num_params, &params, &soap_version TSRMLS_CC);
+               function = deseralize_function_call(service->sdl, doc_request, service->actor, &function_name, &num_params, &params, &soap_version, &soap_headers TSRMLS_CC);
                xmlFreeDoc(doc_request);
 
                if (service->type == SOAP_CLASS) {
@@ -1125,6 +1142,34 @@ PHP_METHOD(soapserver, handle)
 
                doc_return = NULL;
 
+               /* Process soap headers */
+               if (soap_headers != NULL) {
+                       soapHeader *header = soap_headers;
+                       while (header != NULL) {
+                               soapHeader *h = header;
+
+                               header = header->next;
+                               if (service->sdl && !h->function && h->mustUnderstand) {
+                                       soap_server_fault("MustUnderstand","Header not understood", NULL, NULL);
+                               }
+
+                               fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name));
+                               if (zend_hash_exists(function_table, php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name) + 1)) {
+                                       if (service->type == SOAP_CLASS) {
+                                               call_status = call_user_function(NULL, &soap_obj, &h->function_name, &h->retval, h->num_params, h->parameters TSRMLS_CC);
+                                       } else {
+                                               call_status = call_user_function(EG(function_table), NULL, &h->function_name, &h->retval, h->num_params, h->parameters TSRMLS_CC);
+                                       }
+                                       if (call_status != SUCCESS) {
+                                               php_error(E_ERROR, "Function '%s' call failed", Z_STRVAL(function_name));
+                                       }
+                               } else if (h->mustUnderstand) {
+                                       soap_server_fault("MustUnderstand","Header not understood", NULL, NULL);
+                               }
+                               efree(fn_name);
+                       }
+               }
+
                fn_name = estrndup(Z_STRVAL(function_name),Z_STRLEN(function_name));
                if (zend_hash_exists(function_table, php_strtolower(fn_name, Z_STRLEN(function_name)), Z_STRLEN(function_name) + 1)) {
                        if (service->type == SOAP_CLASS) {
@@ -1141,9 +1186,8 @@ PHP_METHOD(soapserver, handle)
                efree(fn_name);
 
                if (call_status == SUCCESS) {
-                       sdlFunctionPtr function;
                        char *response_name;
-                       function = get_function(service->sdl, Z_STRVAL(function_name));
+
                        if (function && function->responseName) {
                                response_name = estrdup(function->responseName);
                        } else {
@@ -1151,13 +1195,29 @@ PHP_METHOD(soapserver, handle)
                                sprintf(response_name,"%sResponse",Z_STRVAL(function_name));
                        }
                        SOAP_GLOBAL(overrides) = service->mapping;
-                       doc_return = seralize_response_call(function, response_name, service->uri, &retval, soap_version TSRMLS_CC);
+                       doc_return = seralize_response_call(function, response_name, service->uri, &retval, soap_headers, soap_version TSRMLS_CC);
                        SOAP_GLOBAL(overrides) = NULL;
                        efree(response_name);
                } else {
                        php_error(E_ERROR, "Function '%s' call failed", Z_STRVAL(function_name));
                }
 
+               /* Free soap headers */
+               while (soap_headers != NULL) {
+                       soapHeader *h = soap_headers;
+                       int i;
+
+                       soap_headers = soap_headers->next;
+                       i = h->num_params;
+                       while (i > 0) {
+                               zval_ptr_dtor(&h->parameters[--i]);
+                       }
+                       efree(h->parameters);
+                       zval_dtor(&h->function_name);
+                       zval_dtor(&h->retval);
+                       efree(h);
+               }
+
                SOAP_GLOBAL(soap_version) = old_soap_version;
                SOAP_GLOBAL(sdl) = old_sdl;
 
@@ -1221,7 +1281,7 @@ static void soap_server_fault(char* code, char* string, char *actor, zval* detai
 
        set_soap_fault(&ret, code, string, actor, details TSRMLS_CC);
 
-       doc_return = seralize_response_call(NULL, NULL, NULL, &ret, soap_version TSRMLS_CC);
+       doc_return = seralize_response_call(NULL, NULL, NULL, &ret, NULL, soap_version TSRMLS_CC);
 
        xmlDocDumpMemory(doc_return, &buf, &size);
 
@@ -1726,13 +1786,10 @@ static void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char
                int soap_version = SOAP_GLOBAL(soap_version);
                smart_str code = {0};
                if (soap_version == SOAP_1_1) {
-                       if (strcmp(fault_code,"Client") == 0) {
-                               smart_str_appendl(&code, SOAP_1_1_ENV_NS_PREFIX, sizeof(SOAP_1_1_ENV_NS_PREFIX)-1);
-                               smart_str_appendc(&code, ':');
-                       } else if (strcmp(fault_code,"Server") == 0) {
-                               smart_str_appendl(&code, SOAP_1_1_ENV_NS_PREFIX, sizeof(SOAP_1_1_ENV_NS_PREFIX)-1);
-                               smart_str_appendc(&code, ':');
-                       } else if (strcmp(fault_code,"VersionMismatch") == 0) {
+                       if (strcmp(fault_code,"Client") == 0 ||
+                           strcmp(fault_code,"Server") == 0 ||
+                           strcmp(fault_code,"VersionMismatch") == 0 ||
+                           strcmp(fault_code,"MustUnderstand") == 0) {
                                smart_str_appendl(&code, SOAP_1_1_ENV_NS_PREFIX, sizeof(SOAP_1_1_ENV_NS_PREFIX)-1);
                                smart_str_appendc(&code, ':');
                        }
@@ -1746,9 +1803,12 @@ static void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char
                                smart_str_appendl(&code, SOAP_1_2_ENV_NS_PREFIX, sizeof(SOAP_1_2_ENV_NS_PREFIX)-1);
                                smart_str_appendc(&code, ':');
                                smart_str_appendl(&code,"Receiver",sizeof("Receiver")-1);
-                       } else if (strcmp(fault_code,"VersionMismatch") == 0) {
+                       } else if (strcmp(fault_code,"VersionMismatch") == 0 ||
+                                  strcmp(fault_code,"MustUnderstand") == 0 ||
+                                  strcmp(fault_code,"DataEncodingUnknown") == 0) {
                                smart_str_appendl(&code, SOAP_1_2_ENV_NS_PREFIX, sizeof(SOAP_1_2_ENV_NS_PREFIX)-1);
                                smart_str_appendc(&code, ':');
+                               smart_str_appends(&code,fault_code);
                        } else {
                                smart_str_appends(&code,fault_code);
                        }
@@ -1765,13 +1825,117 @@ static void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char
        }
 }
 
-static void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *function_name, int *num_params, zval ***parameters, int *version TSRMLS_DC)
+static void deseralize_parameters(xmlNodePtr params, sdlFunctionPtr function, int *num_params, zval ***parameters)
+{
+       int cur_param = 0,num_of_params = 0;
+       zval **tmp_parameters = NULL;
+
+       if (function != NULL) {
+               sdlParamPtr *param;
+               xmlNodePtr val;
+               int     use_names = 0;
+
+               if (function->requestParameters == NULL) {
+                       return;
+               }
+               num_of_params = zend_hash_num_elements(function->requestParameters);
+               zend_hash_internal_pointer_reset(function->requestParameters);
+               while (zend_hash_get_current_data(function->requestParameters, (void **)&param) == SUCCESS) {
+                       if (get_node(params, (*param)->paramName) != NULL) {
+                               use_names = 1;
+                       }
+                       zend_hash_move_forward(function->requestParameters);
+               }
+               if (use_names) {
+                       tmp_parameters = emalloc(num_of_params * sizeof(zval *));
+                       zend_hash_internal_pointer_reset(function->requestParameters);
+                       while (zend_hash_get_current_data(function->requestParameters, (void **)&param) == SUCCESS) {
+                               val = get_node(params, (*param)->paramName);
+                               if (!val) {
+                                       /* TODO: may be "nil" is not OK? */
+                                       MAKE_STD_ZVAL(tmp_parameters[cur_param]);
+                                       ZVAL_NULL(tmp_parameters[cur_param]);
+                               } else {
+                                       tmp_parameters[cur_param] = master_to_zval((*param)->encode, val);
+                               }
+                               cur_param++;
+
+                               zend_hash_move_forward(function->requestParameters);
+                       }
+                       (*parameters) = tmp_parameters;
+                       (*num_params) = num_of_params;
+                       return;
+               }
+       }
+       if (params) {
+               xmlNodePtr trav;
+
+               num_of_params = 0;
+               trav = params;
+               while (trav != NULL) {
+                       if (trav->type == XML_ELEMENT_NODE) {
+                               num_of_params++;
+                       }
+                       trav = trav->next;
+               }
+               if (num_of_params > 0) {
+                       tmp_parameters = emalloc(num_of_params * sizeof(zval *));
+
+                       trav = params;
+                       while (trav != 0 && cur_param < num_of_params) {
+                               if (trav->type == XML_ELEMENT_NODE) {
+                                       encodePtr enc;
+                                       sdlParamPtr *param = NULL;
+                                       if (function != NULL &&
+                                           zend_hash_index_find(function->requestParameters, cur_param, (void **)&param) == FAILURE) {
+                                               php_error(E_ERROR, "Error cannot find parameter");
+                                       }
+                                       if (param == NULL) {
+                                               enc = NULL;
+                                       } else {
+                                               enc = (*param)->encode;
+                                       }
+                                       tmp_parameters[cur_param] = master_to_zval(enc, trav);
+                                       cur_param++;
+                               }
+                               trav = trav->next;
+                       }
+               }
+       }
+       (*parameters) = tmp_parameters;
+       (*num_params) = num_of_params;
+}
+
+static sdlFunctionPtr find_function(sdlPtr sdl, xmlNodePtr func, zval* function_name)
+{
+       sdlFunctionPtr function;
+
+       function = get_function(sdl, func->name);
+       if (function && function->binding && function->binding->bindingType == BINDING_SOAP) {
+               sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
+               if (fnb->style == SOAP_DOCUMENT) {
+                       function = NULL;
+               }
+       }
+       if (sdl != NULL && function == NULL) {
+               function = get_doc_function(sdl, func);
+       }
+
+       INIT_ZVAL(*function_name);
+       if (function != NULL) {
+               ZVAL_STRING(function_name, (char *)function->functionName, 1);
+       } else{
+               ZVAL_STRING(function_name, (char *)func->name, 1);
+       }
+
+       return function;
+}
+
+static sdlFunctionPtr deseralize_function_call(sdlPtr sdl, xmlDocPtr request, char* actor, zval *function_name, int *num_params, zval ***parameters, int *version, soapHeader **headers TSRMLS_DC)
 {
        char* envelope_ns = NULL;
        xmlNodePtr trav,env,head,body,func;
        xmlAttrPtr attr;
-       int cur_param = 0,num_of_params = 0;
-       zval tmp_function_name, **tmp_parameters = NULL;
        sdlFunctionPtr function;
 
        ZVAL_EMPTY_STRING(function_name);
@@ -1805,8 +1969,12 @@ static void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *functi
        while (attr != NULL) {
                if (attr->ns == NULL) {
                        php_error(E_ERROR,"A SOAP Envelope element cannot have non Namespace qualified attributes");
-               } else if (*version == SOAP_1_2 && attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
-                       php_error(E_ERROR,"encodingStyle cannot be specified on the Envelope");
+               } else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
+                       if (*version == SOAP_1_2) {
+                               php_error(E_ERROR,"encodingStyle cannot be specified on the Envelope");
+                       } else if (strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) {
+                               php_error(E_ERROR,"Unknown data encoding style");
+                       }
                }
                attr = attr->next;
        }
@@ -1837,9 +2005,20 @@ static void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *functi
        if (body == NULL) {
                php_error(E_ERROR,"Body must be present in a SOAP envelope");
        }
-       attr = get_attribute_ex(body->properties,"encodingStyle",SOAP_1_2_ENV_NAMESPACE);
-       if (attr && *version == SOAP_1_2) {
-               php_error(E_ERROR,"encodingStyle cannot be specified on the Body");
+       attr = body->properties;
+       while (attr != NULL) {
+               if (attr->ns == NULL) {
+                       if (*version == SOAP_1_2) {
+                               php_error(E_ERROR,"A SOAP Body element cannot have non Namespace qualified attributes");
+                       }
+               } else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
+                       if (*version == SOAP_1_2) {
+                               php_error(E_ERROR,"encodingStyle cannot be specified on the Body");
+                       } else if (strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) {
+                               php_error(E_ERROR,"Unknown data encoding style");
+                       }
+               }
+               attr = attr->next;
        }
 
        if (trav != NULL && *version == SOAP_1_2) {
@@ -1860,121 +2039,239 @@ static void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *functi
        if (func == NULL) {
                function = get_doc_function(sdl, NULL);
                if (function != NULL) {
-                       func = body;
+                       INIT_ZVAL(*function_name);
+                       ZVAL_STRING(function_name, (char *)function->functionName, 1);
                } else {
                        php_error(E_ERROR,"looks like we got \"Body\" without function call");
                }
        } else {
-               function = get_function(sdl, func->name);
-               if (function && function->binding && function->binding->bindingType == BINDING_SOAP) {
-                       sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
-                       if (fnb->style == SOAP_DOCUMENT) {
-                               function = NULL;
+               if (*version == SOAP_1_1) {
+                       attr = get_attribute_ex(func->properties,"encodingStyle",SOAP_1_1_ENV_NAMESPACE);
+                       if (attr && strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) {
+                               soap_server_fault("Client","Unknown Data Encoding Style", NULL, NULL);
+                       }
+               } else {
+                       attr = get_attribute_ex(func->properties,"encodingStyle",SOAP_1_2_ENV_NAMESPACE);
+                       if (attr && strcmp(attr->children->content,SOAP_1_2_ENC_NAMESPACE) != 0) {
+                               soap_server_fault("DataEncodingUnknown","Unknown Data Encoding Style", NULL, NULL);
                        }
                }
+               function = find_function(sdl, func, function_name);
                if (sdl != NULL && function == NULL) {
-                       function = get_doc_function(sdl, func);
-                       if (function != NULL) {
-                               func = body;
+                       if (*version == SOAP_1_2) {
+                               soap_server_fault("rpc:ProcedureNotPresent","Procedure not present", NULL, NULL);
                        } else {
+                               php_error(E_ERROR, "Procedure '%s' not present", func->name);
+                       }
+               }
+       }
+
+       *headers = NULL;
+       if (head) {
+               soapHeader *h, *last = NULL;
+
+               attr = head->properties;
+               while (attr != NULL) {
+                       if (attr->ns == NULL) {
+                               php_error(E_ERROR,"A SOAP Header element cannot have non Namespace qualified attributes");
+                       } else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
                                if (*version == SOAP_1_2) {
-                                       soap_server_fault("rpc:ProcedureNotPresent","Procedure not present", NULL, NULL);
+                                       php_error(E_ERROR,"encodingStyle cannot be specified on the Header");
+                               } else if (strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) {
+                                       php_error(E_ERROR,"Unknown data encoding style");
+                               }
+                       }
+                       attr = attr->next;
+               }
+               trav = head->children;
+               while (trav != NULL) {
+                       if (trav->type == XML_ELEMENT_NODE) {
+                               xmlNodePtr func = trav;
+                               xmlAttrPtr attr;
+                               int mustUnderstand = 0;
+
+                               if (*version == SOAP_1_1) {
+                                       attr = get_attribute_ex(func->properties,"encodingStyle",SOAP_1_1_ENV_NAMESPACE);
+                                       if (attr && strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) {
+                                               soap_server_fault("Client","Unknown Data Encoding Style", NULL, NULL);
+                                       }
+                                       attr = get_attribute_ex(func->properties,"actor",envelope_ns);
+                                       if (attr != NULL) {
+                                               if (strcmp(attr->children->content,"http://schemas.xmlsoap.org/soap/actor/next") != 0 &&
+                                                   (actor == NULL || strcmp(attr->children->content,actor) != 0)) {
+                                                 goto ignore_header;
+                                               }
+                                       }
+                               } else if (*version == SOAP_1_2) {
+                                       attr = get_attribute_ex(func->properties,"encodingStyle",SOAP_1_2_ENV_NAMESPACE);
+                                       if (attr && strcmp(attr->children->content,SOAP_1_2_ENC_NAMESPACE) != 0) {
+                                               soap_server_fault("DataEncodingUnknown","Unknown Data Encoding Style", NULL, NULL);
+                                       }
+                                       attr = get_attribute_ex(func->properties,"role",envelope_ns);
+                                       if (attr != NULL) {
+                                               if (strcmp(attr->children->content,"http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver") != 0 &&
+                                                   strcmp(attr->children->content,"http://www.w3.org/2003/05/soap-envelope/role/next") != 0 &&
+                                                   (actor == NULL || strcmp(attr->children->content,actor) != 0)) {
+                                                 goto ignore_header;
+                                               }
+                                       }
+                               }
+                               attr = get_attribute_ex(func->properties,"mustUnderstand",envelope_ns);
+                               if (attr) {
+                                       if (strcmp(attr->children->content,"1") == 0 ||
+                                           strcmp(attr->children->content,"true") == 0) {
+                                               mustUnderstand = 1;
+                                       } else if (strcmp(attr->children->content,"0") == 0 ||
+                                                  strcmp(attr->children->content,"false") == 0) {
+                                               mustUnderstand = 0;
+                                       } else {
+                                               soap_server_fault("Client","mustUnderstand value is not boolean", NULL, NULL);
+                                       }
+                               }
+                               h = emalloc(sizeof(soapHeader));
+                               memset(h, 0, sizeof(soapHeader));
+                               h->function = find_function(sdl, func, &h->function_name);
+                               h->mustUnderstand = mustUnderstand;
+                               if (h->function && h->function->binding && h->function->binding->bindingType == BINDING_SOAP) {
+                                       sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)h->function->bindingAttributes;
+                                       if (fnb->style == SOAP_RPC) {
+                                               func = func->children;
+                                       }
+                               }
+                               deseralize_parameters(func, h->function, &h->num_params, &h->parameters);
+                               INIT_ZVAL(h->retval);
+                               if (last == NULL) {
+                                       *headers = h;
                                } else {
-                                       php_error(E_ERROR, "Procedure '%s' not present", func->name);
+                                       last->next = h;
                                }
+                               last = h;
                        }
+ignore_header:
+                       trav = trav->next;
                }
        }
 
-       INIT_ZVAL(tmp_function_name);
-       if (function != NULL) {
-               ZVAL_STRING(&tmp_function_name, (char *)function->functionName, 1);
-       } else{
-               ZVAL_STRING(&tmp_function_name, (char *)func->name, 1);
+       if (function && function->binding && function->binding->bindingType == BINDING_SOAP) {
+               sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
+               if (fnb->style == SOAP_RPC) {
+                       func = func->children;
+               }
+       } else {
+               func = func->children;
        }
+       deseralize_parameters(func, function, num_params, parameters);
+       return function;
+}
 
-       (*function_name) = tmp_function_name;
+static int seralize_response_call2(xmlNodePtr body, sdlFunctionPtr function, char *function_name, char *uri, zval *ret, int version, int main TSRMLS_DC)
+{
+       xmlNodePtr method = NULL, param;
+       sdlParamPtr parameter = NULL;
+       int param_count;
+       int style, use;
+       xmlNsPtr ns = NULL;
 
-       if (function != NULL) {
-               sdlParamPtr *param;
-               xmlNodePtr val;
-               int     use_names = 0;
+       if (function != NULL && function->binding->bindingType == BINDING_SOAP) {
+               sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
 
-               num_of_params = zend_hash_num_elements(function->requestParameters);
-               zend_hash_internal_pointer_reset(function->requestParameters);
-               while (zend_hash_get_current_data(function->requestParameters, (void **)&param) == SUCCESS) {
-                       zend_hash_move_forward(function->requestParameters);
-                       if (get_node(func->children, (*param)->paramName) != NULL) {
-                               use_names = 1;
+               style = fnb->style;
+               use = fnb->output.use;
+               if (style == SOAP_RPC) {
+                       ns = encode_add_ns(body, fnb->output.ns);
+                       if (function->responseName) {
+                               method = xmlNewChild(body, ns, function->responseName, NULL);
+                       } else {
+                               method = xmlNewChild(body, ns, function->functionName, NULL);
                        }
-                       zend_hash_move_forward(function->requestParameters);
                }
-               if (use_names) {
-                       tmp_parameters = emalloc(num_of_params * sizeof(zval *));
-                       zend_hash_internal_pointer_reset(function->requestParameters);
-                       while (zend_hash_get_current_data(function->requestParameters, (void **)&param) == SUCCESS) {
-                               val = get_node(func->children, (*param)->paramName);
-                               if (!val) {
-                                       /* TODO: may be "nil" is not OK? */
-                                       MAKE_STD_ZVAL(tmp_parameters[cur_param]);
-                                       ZVAL_NULL(tmp_parameters[cur_param]);
-                               } else {
-                                       tmp_parameters[cur_param] = master_to_zval((*param)->encode, val);
-                               }
-                               cur_param++;
+       } else {
+               style = main?SOAP_RPC:SOAP_DOCUMENT;
+               use = main?SOAP_ENCODED:SOAP_LITERAL;
+               ns = encode_add_ns(body, uri);
+               method = xmlNewChild(body, ns, function_name, NULL);
+       }
 
-                               zend_hash_move_forward(function->requestParameters);
-                       }
-                       (*parameters) = tmp_parameters;
-                       (*num_params) = num_of_params;
-                       return;
+       if (function != NULL) {
+               if (function->responseParameters) {
+                       param_count = zend_hash_num_elements(function->responseParameters);
+               } else {
+                 param_count = 0;
                }
+       } else {
+         param_count = 1;
        }
-       if (func->children) {
-               num_of_params = 0;
-               trav = func->children;
-               while (trav != NULL) {
-                       if (trav->type == XML_ELEMENT_NODE) {
-                               num_of_params++;
+
+       if (param_count == 1) {
+               parameter = get_param(function, NULL, 0, TRUE);
+
+               if (style == SOAP_RPC) {
+                 xmlNode *rpc_result;
+                       if (main && version == SOAP_1_2) {
+                               xmlNs *rpc_ns = xmlNewNs(body, RPC_SOAP12_NAMESPACE, RPC_SOAP12_NS_PREFIX);
+                               rpc_result = xmlNewChild(method, rpc_ns, "result", NULL);
+                       }
+                       param = seralize_parameter(parameter, ret, 0, "return", use, method TSRMLS_CC);
+                       if (main && version == SOAP_1_2) {
+                               xmlNodeSetContent(rpc_result,param->name);
+                       }
+               } else {
+                       param = seralize_parameter(parameter, ret, 0, "return", use, body TSRMLS_CC);
+                       if (function && function->binding->bindingType == BINDING_SOAP) {
+                               sdlParamPtr *sparam;
+
+                               if (zend_hash_index_find(function->responseParameters, 0, (void **)&sparam) == SUCCESS && (*sparam)->element) {
+                                       ns = encode_add_ns(param, (*sparam)->element->namens);
+                                       xmlNodeSetName(param, (*sparam)->element->name);
+                                       xmlSetNs(param, ns);
+                               }
                        }
-                       trav = trav->next;
                }
-               if (num_of_params > 0) {
-                       tmp_parameters = emalloc(num_of_params * sizeof(zval *));
+       } else if (param_count > 1 && Z_TYPE_P(ret) == IS_ARRAY) {
+               HashPosition pos;
+               zval **data;
+               int i = 0;
 
-                       trav = func->children;
-                       while (trav != 0 && cur_param < num_of_params) {
-                               if (trav->type == XML_ELEMENT_NODE) {
-                                       encodePtr enc;
-                                       sdlParamPtr *param = NULL;
-                                       if (function != NULL &&
-                                           zend_hash_index_find(function->requestParameters, cur_param, (void **)&param) == FAILURE) {
-                                               php_error(E_ERROR, "Error cannot find parameter");
-                                       }
-                                       if (param == NULL) {
-                                               enc = NULL;
-                                       } else {
-                                               enc = (*param)->encode;
+               zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(ret), &pos);
+               while (zend_hash_get_current_data_ex(Z_ARRVAL_P(ret), (void **)&data, &pos) != FAILURE) {
+                       char *param_name;
+                       int   param_name_len;
+                       long  param_index;
+
+                       zend_hash_get_current_key_ex(Z_ARRVAL_P(ret), &param_name, &param_name_len, &param_index, 0, &pos);
+                       parameter = get_param(function, param_name, param_index, TRUE);
+
+                       if (style == SOAP_RPC) {
+                               param = seralize_parameter(parameter, *data, i, param_name, use, method TSRMLS_CC);
+                       } else {
+                               param = seralize_parameter(parameter, *data, i, param_name, use, body TSRMLS_CC);
+                               if (function && function->binding->bindingType == BINDING_SOAP) {
+                                       sdlParamPtr *sparam;
+
+                                       if (zend_hash_index_find(function->responseParameters, i, (void **)&sparam) == SUCCESS) {
+                                               ns = encode_add_ns(param, (*sparam)->encode->details.ns);
+                                               xmlNodeSetName(param, (*sparam)->encode->details.type_str);
+                                               xmlSetNs(param, ns);
                                        }
-                                       tmp_parameters[cur_param] = master_to_zval(enc, trav);
-                                       cur_param++;
                                }
-                               trav = trav->next;
                        }
+
+                       zend_hash_move_forward_ex(Z_ARRVAL_P(ret), &pos);
+                       i++;
                }
        }
-       (*parameters) = tmp_parameters;
-       (*num_params) = num_of_params;
+       if (use == SOAP_ENCODED && version == SOAP_1_2 && method != NULL) {
+               xmlSetNsProp(method, body->ns, "encodingStyle", SOAP_1_2_ENC_NAMESPACE);
+       }
+       return use;
 }
 
-static xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_name, char *uri, zval *ret, int version TSRMLS_DC)
+static xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_name, char *uri, zval *ret, soapHeader* headers, int version TSRMLS_DC)
 {
-       xmlDoc *doc;
-       xmlNode *envelope = NULL, *body,*method = NULL, *param;
-       xmlNs *ns = NULL;
-       sdlParamPtr parameter = NULL;
-       int param_count;
-       int style, use;
+       xmlDocPtr doc;
+       xmlNodePtr envelope = NULL, body, param;
+       xmlNsPtr ns = NULL;
+       int use = SOAP_LITERAL;
 
        encode_reset_ns();
 
@@ -1995,10 +2292,10 @@ static xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_
        }
        xmlDocSetRootElement(doc, envelope);
 
-       body = xmlNewChild(envelope, ns, "Body", NULL);
 
        if (Z_TYPE_P(ret) == IS_OBJECT &&
                Z_OBJCE_P(ret) == soap_fault_class_entry) {
+               body = xmlNewChild(envelope, ns, "Body", NULL);
                use = SOAP_ENCODED;
                if (version == SOAP_1_1) {
                        HashTable* prop;
@@ -2063,94 +2360,34 @@ static xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_
                }
        } else {
 
-               if (function != NULL && function->binding->bindingType == BINDING_SOAP) {
-                       sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
+               if (headers) {
+                       xmlNodePtr head;
+                       soapHeader *h;
 
-                       style = fnb->style;
-                       use = fnb->output.use;
-                       if (style == SOAP_RPC) {
-                               ns = encode_add_ns(body, fnb->output.ns);
-                               if (function->responseName) {
-                                       method = xmlNewChild(body, ns, function->responseName, NULL);
-                               } else {
-                                       method = xmlNewChild(body, ns, function->functionName, NULL);
+                       head = xmlNewChild(envelope, ns, "Header", NULL);
+                       h = headers;
+                       while (h != NULL) {
+                               if (Z_TYPE(h->retval) != IS_NULL) {
+                                       if (seralize_response_call2(head, h->function, Z_STRVAL(h->function_name), uri, &h->retval, version, 0 TSRMLS_CC) == SOAP_ENCODED) {
+                                               use = SOAP_ENCODED;
+                                       }
                                }
+                               h = h->next;
                        }
-               } else {
-                       style = SOAP_RPC;
-                       use = SOAP_ENCODED;
-                       ns = encode_add_ns(body, uri);
-                       method = xmlNewChild(body, ns, function_name, NULL);
-               }
 
-               if (function != NULL) {
-                       if (function->responseParameters) {
-                               param_count = zend_hash_num_elements(function->responseParameters);
-                       } else {
-                         param_count = 0;
+                       if (head->children == NULL) {
+                               xmlUnlinkNode(head);
+                               xmlFreeNode(head);
                        }
-               } else {
-                 param_count = 1;
-               }
 
-               if (param_count == 1) {
-                       parameter = get_param(function, NULL, 0, TRUE);
+               }
 
-                       if (style == SOAP_RPC) {
-                         xmlNode *rpc_result;
-                               if (version == SOAP_1_2) {
-                                       xmlNs *rpc_ns = xmlNewNs(body, RPC_SOAP12_NAMESPACE, RPC_SOAP12_NS_PREFIX);
-                                       rpc_result = xmlNewChild(method, rpc_ns, "result", NULL);
-                               }
-                               param = seralize_parameter(parameter, ret, 0, "return", use, method TSRMLS_CC);
-                               if (version == SOAP_1_2) {
-                                       xmlNodeSetContent(rpc_result,param->name);
-                               }
-                       } else {
-                               param = seralize_parameter(parameter, ret, 0, "return", use, body TSRMLS_CC);
-                               if (function && function->binding->bindingType == BINDING_SOAP) {
-                                       sdlParamPtr *sparam;
+               body = xmlNewChild(envelope, ns, "Body", NULL);
 
-                                       if (zend_hash_index_find(function->responseParameters, 0, (void **)&sparam) == SUCCESS && (*sparam)->element) {
-                                               ns = encode_add_ns(param, (*sparam)->element->namens);
-                                               xmlNodeSetName(param, (*sparam)->element->name);
-                                               xmlSetNs(param, ns);
-                                       }
-                               }
-                       }
-               } else if (param_count > 1 && Z_TYPE_P(ret) == IS_ARRAY) {
-                       HashPosition pos;
-                       zval **data;
-                       int i = 0;
-
-                       zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(ret), &pos);
-                       while (zend_hash_get_current_data_ex(Z_ARRVAL_P(ret), (void **)&data, &pos) != FAILURE) {
-                               char *param_name;
-                               int   param_name_len;
-                               long  param_index;
-
-                               zend_hash_get_current_key_ex(Z_ARRVAL_P(ret), &param_name, &param_name_len, &param_index, 0, &pos);
-                               parameter = get_param(function, param_name, param_index, TRUE);
-
-                               if (style == SOAP_RPC) {
-                                       param = seralize_parameter(parameter, *data, i, param_name, use, method TSRMLS_CC);
-                               } else {
-                                       param = seralize_parameter(parameter, *data, i, param_name, use, body TSRMLS_CC);
-                                       if (function && function->binding->bindingType == BINDING_SOAP) {
-                                               sdlParamPtr *sparam;
-
-                                               if (zend_hash_index_find(function->responseParameters, i, (void **)&sparam) == SUCCESS) {
-                                                       ns = encode_add_ns(param, (*sparam)->encode->details.ns);
-                                                       xmlNodeSetName(param, (*sparam)->encode->details.type_str);
-                                                       xmlSetNs(param, ns);
-                                               }
-                                       }
-                               }
-
-                               zend_hash_move_forward_ex(Z_ARRVAL_P(ret), &pos);
-                               i++;
-                       }
+               if (seralize_response_call2(body, function, function_name, uri, ret, version, 1 TSRMLS_CC) == SOAP_ENCODED) {
+                       use = SOAP_ENCODED;
                }
+
        }
 
        if (use == SOAP_ENCODED) {
@@ -2161,9 +2398,6 @@ static xmlDocPtr seralize_response_call(sdlFunctionPtr function, char *function_
                        xmlSetNsProp(envelope, envelope->ns, "encodingStyle", SOAP_1_1_ENC_NAMESPACE);
                } else if (version == SOAP_1_2) {
                        xmlNewNs(envelope, SOAP_1_2_ENC_NAMESPACE, SOAP_1_2_ENC_NS_PREFIX);
-                       if (method) {
-                               xmlSetNsProp(method, envelope->ns, "encodingStyle", SOAP_1_2_ENC_NAMESPACE);
-                       }
                }
        }
 
@@ -2375,7 +2609,7 @@ static sdlFunctionPtr get_doc_function(sdlPtr sdl, xmlNodePtr params)
        if (sdl) {
                sdlFunctionPtr *tmp;
                sdlParamPtr    *param;
-               
+
                zend_hash_internal_pointer_reset(&sdl->functions);
                while (zend_hash_get_current_data(&sdl->functions, (void**)&tmp) == SUCCESS) {
                        if ((*tmp)->binding && (*tmp)->binding->bindingType == BINDING_SOAP) {
@@ -2385,8 +2619,9 @@ static sdlFunctionPtr get_doc_function(sdlPtr sdl, xmlNodePtr params)
                                                if ((*tmp)->requestParameters == NULL ||
                                                    zend_hash_num_elements((*tmp)->requestParameters) == 0) {
                                                  return *tmp;
-                                               } 
-                                       } else if ((*tmp)->requestParameters != NULL) {
+                                               }
+                                       } else if ((*tmp)->requestParameters != NULL &&
+                                                  zend_hash_num_elements((*tmp)->requestParameters) > 0) {
                                                int ok = 1;
                                                xmlNodePtr node = params;
 
@@ -2394,30 +2629,32 @@ static sdlFunctionPtr get_doc_function(sdlPtr sdl, xmlNodePtr params)
                                                while (zend_hash_get_current_data((*tmp)->requestParameters, (void**)&param) == SUCCESS) {
                                                  if ((*param)->element) {
                                                        if (strcmp((*param)->element->name,node->name) != 0) {
-                                                               ok = 0; 
+                                                               ok = 0;
                                                                break;
                                                        }
                                                        if ((*param)->element->namens != NULL && node->ns != NULL) {
                                                                if (strcmp((*param)->element->namens,node->ns->href) != 0) {
-                                                                       ok = 0; 
+                                                                       ok = 0;
                                                                        break;
                                                                }
                                                        } else if ((void*)(*param)->element->namens != (void*)node->ns) {
-                                                               ok = 0; 
+                                                               ok = 0;
                                                                break;
                                                        }
                                                  } else if (strcmp((*param)->paramName,node->name) != 0) {
-                                                       ok = 0; 
+                                                       ok = 0;
                                                        break;
                                                  }
                                                        zend_hash_move_forward((*tmp)->requestParameters);
+/*
                                                        do {
                                                                node = node->next;
                                                        } while (node != NULL && node->type != XML_ELEMENT_NODE);
+*/
                                                }
-                                               if (ok && node == NULL) {
+                                               if (ok /*&& node == NULL*/) {
                                                        return (*tmp);
-                                               }                                               
+                                               }
                                        }
                                }
                        }
@@ -2539,6 +2776,9 @@ static void delete_service(void *data)
                efree(service->soap_class.argv);
        }
 
+       if (service->actor) {
+               efree(service->actor);
+       }
        efree(service->uri);
        efree(service);
 }
diff --git a/ext/soap/tests/soap12/T01.phpt b/ext/soap/tests/soap12/T01.phpt
new file mode 100644 (file)
index 0000000..d584812
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T01 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:echoOk xmlns:test="http://example.org/ts-tests"
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/next">foo</test:echoOk>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Header><ns1:responseOk>foo</ns1:responseOk></env:Header><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T02.phpt b/ext/soap/tests/soap12/T02.phpt
new file mode 100644 (file)
index 0000000..db2c260
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T02 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:echoOk xmlns:test="http://example.org/ts-tests"
+          env:role="http://example.org/ts-tests/C">foo</test:echoOk>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Header><ns1:responseOk>foo</ns1:responseOk></env:Header><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T03.phpt b/ext/soap/tests/soap12/T03.phpt
new file mode 100644 (file)
index 0000000..19c29dd
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+SOAP 1.2: T03 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Header><ns1:responseOk>foo</ns1:responseOk></env:Header><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T04.phpt b/ext/soap/tests/soap12/T04.phpt
new file mode 100644 (file)
index 0000000..7445cae
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T04 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:echoOk xmlns:test="http://example.org/ts-tests"
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:echoOk>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Header><ns1:responseOk>foo</ns1:responseOk></env:Header><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T05.phpt b/ext/soap/tests/soap12/T05.phpt
new file mode 100644 (file)
index 0000000..187eb2e
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T05 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:echoOk xmlns:test="http://example.org/ts-tests"
+          env:role="http://example.org/ts-tests/B">foo</test:echoOk>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T10.phpt b/ext/soap/tests/soap12/T10.phpt
new file mode 100644 (file)
index 0000000..54186f6
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T10 unknownHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://example.org/ts-tests" 
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:Unknown>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T11.phpt b/ext/soap/tests/soap12/T11.phpt
new file mode 100644 (file)
index 0000000..3423d54
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+SOAP 1.2: T11 unknownHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://example.org/ts-tests"
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
+          env:mustUnderstand="false">foo</test:Unknown>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T12.phpt b/ext/soap/tests/soap12/T12.phpt
new file mode 100644 (file)
index 0000000..6902084
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T12 unknownHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://example.org/ts-tests"
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
+          env:mustUnderstand="1">foo</test:Unknown>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"><env:Body><env:Fault><env:Code><env:Value>env:MustUnderstand</env:Value></env:Code><env:Reason><env:Text>Header not understood</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
\ No newline at end of file
diff --git a/ext/soap/tests/soap12/T13.phpt b/ext/soap/tests/soap12/T13.phpt
new file mode 100644 (file)
index 0000000..5b8b799
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T13 unknownHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://example.org/ts-tests"
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
+          env:mustUnderstand="true">foo</test:Unknown>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"><env:Body><env:Fault><env:Code><env:Value>env:MustUnderstand</env:Value></env:Code><env:Reason><env:Text>Header not understood</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
\ No newline at end of file
diff --git a/ext/soap/tests/soap12/T14.phpt b/ext/soap/tests/soap12/T14.phpt
new file mode 100644 (file)
index 0000000..d7f5b24
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T14 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:echoOk xmlns:test="http://example.org/ts-tests"
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
+          env:mustUnderstand="wrong">foo</test:echoOk>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"><env:Body><env:Fault><env:Code><env:Value>env:Sender</env:Value></env:Code><env:Reason><env:Text>mustUnderstand value is not boolean</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
diff --git a/ext/soap/tests/soap12/T15.phpt b/ext/soap/tests/soap12/T15.phpt
new file mode 100644 (file)
index 0000000..546f942
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+SOAP 1.2: T15 unknownHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://example.org/ts-tests"
+          env:role="http://example.org/ts-tests/B"
+          env:mustUnderstand="1">foo</test:Unknown>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T19.phpt b/ext/soap/tests/soap12/T19.phpt
new file mode 100644 (file)
index 0000000..8ddb5b4
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+SOAP 1.2: T19 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:echoOk xmlns:test="http://example.org/ts-tests"
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/none"
+          env:mustUnderstand="true">foo</test:echoOk>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T22.phpt b/ext/soap/tests/soap12/T22.phpt
new file mode 100644 (file)
index 0000000..5844550
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+SOAP 1.2: T22 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:echoOk xmlns:test="http://example.org/ts-tests" 
+          env:mustUnderstand = "1">foo</test:echoOk>
+  </env:Header>
+  <env:Body>
+    <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Header><ns1:responseOk>foo</ns1:responseOk></env:Header><env:Body><ns1:responseOk>foo</ns1:responseOk></env:Body></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T23.phpt b/ext/soap/tests/soap12/T23.phpt
new file mode 100644 (file)
index 0000000..387a77a
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+SOAP 1.2: T23 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://example.org/ts-tests" 
+          env:mustUnderstand="1">foo</test:Unknown>
+    <test:echoOk xmlns:test="http://example.org/ts-tests" 
+          env:mustUnderstand="wrong">foo</test:echoOk>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"><env:Body><env:Fault><env:Code><env:Value>env:Sender</env:Value></env:Code><env:Reason><env:Text>mustUnderstand value is not boolean</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
diff --git a/ext/soap/tests/soap12/T26.phpt b/ext/soap/tests/soap12/T26.phpt
new file mode 100644 (file)
index 0000000..53c8cec
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+SOAP 1.2: T26 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+<?xml-stylesheet href="http://example.org/ts-tests/sub.xsl" type = "text/xsl"?>
+  <env:Body>
+    <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Body><ns1:responseOk>foo</ns1:responseOk></env:Body></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T29.phpt b/ext/soap/tests/soap12/T29.phpt
new file mode 100644 (file)
index 0000000..3784da4
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T29 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:echoOk xmlns:test="http://example.org/ts-tests"
+          env:role="http://example.org/ts-tests/Czzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz">foo</test:echoOk>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T30.phpt b/ext/soap/tests/soap12/T30.phpt
new file mode 100644 (file)
index 0000000..c2e008e
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+SOAP 1.2: T30 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
+  <env:Body>
+    <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://example.org/ts-tests"><SOAP-ENV:Body><ns1:responseOk>foo</ns1:responseOk></SOAP-ENV:Body></SOAP-ENV:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T32.phpt b/ext/soap/tests/soap12/T32.phpt
new file mode 100644 (file)
index 0000000..8f77873
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+SOAP 1.2: T32 echoHeader
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:requiredHeader xmlns:test="http://example.org/ts-tests"
+          env:mustUnderstand="true">foo</test:requiredHeader>
+  </env:Header>
+  <env:Body>
+    <test:echoHeader xmlns:test="http://example.org/ts-tests">
+    </test:echoHeader>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Body><ns1:echoHeaderResponse>foo</ns1:echoHeaderResponse></env:Body></env:Envelope>
+ok
index c39f9e1acea5c1b810191ad485e8c9df113ae7d9..346b847d237f696697d12c3f66b85dc638af2c7a 100644 (file)
@@ -1,5 +1,5 @@
 --TEST--
-SOAP 1.2: T33
+SOAP 1.2: T33 nonexistentMethod
 --SKIPIF--
 <?php require_once('skipif.inc'); ?>
 --FILE--
diff --git a/ext/soap/tests/soap12/T34.phpt b/ext/soap/tests/soap12/T34.phpt
new file mode 100644 (file)
index 0000000..39e0095
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+SOAP 1.2: T34 unknownHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://example.org/ts-tests" 
+          xmlns:env1="http://schemas.xmlsoap.org/soap/envelope/"
+          env1:mustUnderstand="true">foo</test:Unknown>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T35.phpt b/ext/soap/tests/soap12/T35.phpt
new file mode 100644 (file)
index 0000000..d79e12f
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+SOAP 1.2: T35 unknownHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://example.org/ts-tests"
+          env:mustUnderstand="1">
+      foo
+    </test:Unknown>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"><env:Body><env:Fault><env:Code><env:Value>env:MustUnderstand</env:Value></env:Code><env:Reason><env:Text>Header not understood</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
diff --git a/ext/soap/tests/soap12/T36.phpt b/ext/soap/tests/soap12/T36.phpt
new file mode 100644 (file)
index 0000000..dc640a3
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T36 unknownHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://example.org/ts-tests"
+          env:mustUnderstand="1" 
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:Unknown>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"><env:Body><env:Fault><env:Code><env:Value>env:MustUnderstand</env:Value></env:Code><env:Reason><env:Text>Header not understood</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
diff --git a/ext/soap/tests/soap12/T37.phpt b/ext/soap/tests/soap12/T37.phpt
new file mode 100644 (file)
index 0000000..cdce8a4
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T37 unknownHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://example.org/ts-tests"
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:Unknown>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T38_1.phpt b/ext/soap/tests/soap12/T38_1.phpt
new file mode 100644 (file)
index 0000000..30007e5
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+SOAP 1.2: T38.1 doubleHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://example.org/ts-tests"
+          env:mustUnderstand="false" 
+          env:role="http://example.org/ts-tests/C">foo</test:Unknown>
+    <test:echoOk xmlns:test="http://example.org/ts-tests"
+          env:mustUnderstand="0" 
+          env:role="http://example.org/ts-tests/C">foo</test:echoOk>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Header><ns1:responseOk>foo</ns1:responseOk></env:Header><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T38_2.phpt b/ext/soap/tests/soap12/T38_2.phpt
new file mode 100644 (file)
index 0000000..efff2f4
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+SOAP 1.2: T38.2 doubleHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:echoOk xmlns:test="http://example.org/ts-tests"
+          env:mustUnderstand="true" 
+          env:role="http://example.org/ts-tests/C">foo</test:echoOk>
+    <test:echoOk xmlns:test="http://example.org/ts-tests"
+          env:mustUnderstand="1" 
+          env:role="http://example.org/ts-tests/C">bar</test:echoOk>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Header><ns1:responseOk>foo</ns1:responseOk><ns1:responseOk>bar</ns1:responseOk></env:Header><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T39.phpt b/ext/soap/tests/soap12/T39.phpt
new file mode 100644 (file)
index 0000000..7e62d32
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+SOAP 1.2: T39 unknownHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://example.org/ts-tests"
+          env:mustUnderstand="9">foo</test:Unknown>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"><env:Body><env:Fault><env:Code><env:Value>env:Sender</env:Value></env:Code><env:Reason><env:Text>mustUnderstand value is not boolean</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
diff --git a/ext/soap/tests/soap12/T40.phpt b/ext/soap/tests/soap12/T40.phpt
new file mode 100644 (file)
index 0000000..27b4a21
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+SOAP 1.2: T40 echoOK
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:Unknown xmlns:test="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]/ts-tests"
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" 
+          env:mustUnderstand="false">
+      foo
+    </test:Unknown>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body/></env:Envelope>
+ok
\ No newline at end of file
diff --git a/ext/soap/tests/soap12/T66.phpt b/ext/soap/tests/soap12/T66.phpt
new file mode 100644 (file)
index 0000000..cc7cc2e
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T66 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' encoding='UTF8'?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:echoOk xmlns:test="http://example.org/ts-tests"
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/next">foo</test:echoOk>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Header><ns1:responseOk>foo</ns1:responseOk></env:Header><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T67.phpt b/ext/soap/tests/soap12/T67.phpt
new file mode 100644 (file)
index 0000000..ddc527a
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T67 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' standalone='yes'?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+ <env:Header>
+  <test:echoOk xmlns:test="http://example.org/ts-tests"
+        env:role="http://www.w3.org/2003/05/soap-envelope/role/next">foo</test:echoOk>
+ </env:Header>
+ <env:Body>
+ </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Header><ns1:responseOk>foo</ns1:responseOk></env:Header><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T68.phpt b/ext/soap/tests/soap12/T68.phpt
new file mode 100644 (file)
index 0000000..a791519
--- /dev/null
@@ -0,0 +1,32 @@
+--TEST--
+SOAP 1.2: T68 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+
+
+ <env:Header           >
+
+                          <test:echoOk xmlns:test="http://example.org/ts-tests"
+        env:role="http://www.w3.org/2003/05/soap-envelope/role/next"  >foo</test:echoOk>
+  
+
+ </env:Header>
+ <env:Body>
+            
+ </env:Body>
+
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Header><ns1:responseOk>foo</ns1:responseOk></env:Header><env:Body/></env:Envelope>
+ok
index 5ac1be020bf3ad5660c62de4e6714f0dafbe5050..9143e58179d22a4b3ba52d10b30b1e95d1a7a5a1 100644 (file)
@@ -11,7 +11,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <env:Body>
     <test:echoString xmlns:test="http://example.org/ts-tests"
-                     env:encodingStyle="http://www.w3.org/2003/05/soap-envelope/encoding/none">
+                     env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
       <test:inputString xsi:type="xsd:string"
             env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">hello world</test:inputString>
     </test:echoString>
diff --git a/ext/soap/tests/soap12/T74.phpt b/ext/soap/tests/soap12/T74.phpt
new file mode 100644 (file)
index 0000000..703e187
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+SOAP 1.2: T74 doubleHdr
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Header>
+    <test:echoOk xmlns:test="http://example.org/ts-tests"
+          env:role="http://www.w3.org/2003/05/soap-envelope/role/next">foo</test:echoOk>
+    <test:Unknown xmlns:test="http://example.org/ts-tests">
+      <test:raiseFault env:mustUnderstand="1" 
+            env:role="http://www.w3.org/2003/05/soap-envelope/role/next">
+      </test:raiseFault>
+    </test:Unknown>
+  </env:Header>
+  <env:Body>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Header><ns1:responseOk>foo</ns1:responseOk></env:Header><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T78.phpt b/ext/soap/tests/soap12/T78.phpt
new file mode 100644 (file)
index 0000000..63d13c7
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+SOAP 1.2: T78 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+ <env:Header>
+  <test:echoOk xmlns:test="http://example.org/ts-tests"
+        env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:echoOk>
+ </env:Header>
+ <env:Body>
+ </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://example.org/ts-tests"><env:Header><ns1:responseOk>foo</ns1:responseOk></env:Header><env:Body/></env:Envelope>
+ok
diff --git a/ext/soap/tests/soap12/T80.phpt b/ext/soap/tests/soap12/T80.phpt
new file mode 100644 (file)
index 0000000..e7598e5
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+SOAP 1.2: T80 echoOk
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version="1.0"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+  <env:Body>
+    <test:echoOk xmlns:test="http://example.org/ts-tests" env:encodingStyle="http://example.org/PoisonEncoding">foo</test:echoOk>
+  </env:Body>
+</env:Envelope>
+EOF;
+include "soap12-test.inc";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"><env:Body><env:Fault><env:Code><env:Value>env:DataEncodingUnknown</env:Value></env:Code><env:Reason><env:Text>Unknown Data Encoding Style</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
index 44733d2ffd3a69b7a858b91bba7ee4f0c03f6687..47f39e2b413034d3d67a8b0c0507c3a33cabaf84 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 class Soap12test {
+       var $header;
 
        function echoOk($x) {
        return $x;
@@ -95,9 +96,20 @@ class Soap12test {
 
        function returnVoid() {
        }
+
+       function emptyBody() {
+       }
+
+       function requiredHeader($x) {
+               $this->header = $x;
+       }
+
+       function echoHeader() {
+         return $this->header;
+       }
 }
 
-$server = new soapserver("http://http://example.org/ts-tests");
+$server = new soapserver("http://http://example.org/ts-tests","http://example.org/ts-tests/C");
 $server->bind(dirname(__FILE__)."/soap12-test.wsdl");
 $server->setClass("Soap12test");
 
index e1feccfca87442d92aa56cc37131e206bf617040..83a6423176d875e285a91af32cb4f327000e2663 100644 (file)
                        <!-- 3.2.4 requiredHeader -->\r
                        <element name="requiredHeader" type="xsd:string"/>\r
 \r
+                       <element name="echoHeader" type="xsd:string"/>\r
+                       <element name="echoHeaderResponse" type="xsd:string"/>\r
+\r
                        <!-- 3.2.5 DataHolder -->\r
                        <element name="DataHolder" type="test:DataHolder_t"/>\r
                        <complexType name="DataHolder_t">\r
                <part name="responseOk" element="test:responseOk"/>\r
        </message>\r
 \r
+       <message name="requiredHeaderRequest">\r
+               <part name="requiredHeader" element="test:requiredHeader"/>\r
+       </message>\r
+       <message name="echoHeaderRequest">\r
+               <part name="responseHeader" element="test:echoHeader"/>\r
+       </message>\r
+       <message name="echoHeaderResponse">\r
+               <part name="responseHeader" element="test:echoHeaderResponse"/>\r
+       </message>\r
+\r
        <!-- "unknown" header block -->\r
        <message name="UnknownHdrBlockLit">\r
                <part name="Unknown" element="test:Unknown" />\r
                        <input message="tns:echoOkRequest" />\r
                        <output message="tns:echoOkResponse" />\r
                </operation>\r
+               <operation name="requiredHeader">\r
+                       <input message="tns:requiredHeaderRequest" />\r
+               </operation>\r
+               <operation name="echoHeader">\r
+                       <input message="tns:echoHeaderRequest" />\r
+                       <output message="tns:echoHeaderResponse" />\r
+               </operation>\r
        </portType>\r
 \r
        <portType name="Soap12TestPortTypeRpc">\r
                                <soap12:header message="tns:echoOkResponse" part="responseOk" use="literal" />\r
                        </output>\r
                </operation>\r
+               <operation name="requiredHeader">\r
+                       <soap12:operation/>\r
+                       <input>\r
+                               <soap12:body use="literal" />\r
+                               <soap12:header message="tns:echoOkRequest" part="echoOk" use="literal" />\r
+                               <soap12:header message="tns:UnknownHdrBlockLit" part="Unknown" use="literal" />\r
+                       </input>\r
+               </operation>\r
+               <operation name="echoHeader">\r
+                       <soap12:operation/>\r
+                       <input>\r
+                               <soap12:body use="literal" />\r
+                               <soap12:header message="tns:echoOkRequest" part="echoOk" use="literal" />\r
+                               <soap12:header message="tns:UnknownHdrBlockLit" part="Unknown" use="literal" />\r
+                       </input>\r
+                       <output>\r
+                               <soap12:body use="literal" />\r
+                               <soap12:header message="tns:echoOkResponse" part="responseOk" use="literal" />\r
+                       </output>\r
+               </operation>\r
        </binding>\r
 \r
        <binding name="Soap12TestRpcBinding" type="tns:Soap12TestPortTypeRpc">\r
 \r
 \r
        <service name="WhiteMesaSoap12TestSvc">\r
-\r
                <port name="Soap12TestDocPort" binding="tns:Soap12TestDocBinding">\r
                        <soap12:address location="http://localhost/soap12/test-doc"/>\r
                </port>\r