dmitry          Mon Mar 21 10:57:17 2005 EDT

  Modified files:              (Branch: PHP_5_0)
    /php-src/ext/soap   php_sdl.c php_sdl.h 
  Log:
  Support for <soap:body> "parts" attribute.
  
  
http://cvs.php.net/diff.php/php-src/ext/soap/php_sdl.c?r1=1.70.2.6&r2=1.70.2.7&ty=u
Index: php-src/ext/soap/php_sdl.c
diff -u php-src/ext/soap/php_sdl.c:1.70.2.6 php-src/ext/soap/php_sdl.c:1.70.2.7
--- php-src/ext/soap/php_sdl.c:1.70.2.6 Mon Jan 31 10:08:36 2005
+++ php-src/ext/soap/php_sdl.c  Mon Mar 21 10:57:16 2005
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_sdl.c,v 1.70.2.6 2005/01/31 15:08:36 dmitry Exp $ */
+/* $Id: php_sdl.c,v 1.70.2.7 2005/03/21 15:57:16 dmitry Exp $ */
 
 #include "php_soap.h"
 #include "ext/libxml/php_libxml.h"
@@ -76,7 +76,6 @@
 static sdlTypePtr get_element(sdlPtr sdl, xmlNodePtr node, const char *type)
 {
        sdlTypePtr ret = NULL;
-       TSRMLS_FETCH();
 
        if (sdl->elements) {
                xmlNsPtr nsptr;
@@ -481,8 +480,43 @@
 
                        tmp = get_attribute(body->properties, "parts");
                        if (tmp) {
-                               whiteSpace_collapse(tmp->children->content);
-                               binding->parts = 
estrdup(tmp->children->content);
+                               HashTable    ht;
+                               char *parts = tmp->children->content;
+
+                               /* Delete all parts those are not in the 
"parts" attribute */
+                               zend_hash_init(&ht, 0, NULL, delete_parameter, 
0);
+                               while (*parts) {
+                                       HashPosition pos;
+                                       sdlParamPtr *param;
+                                       int found = 0;
+                                       char *end;
+
+                                       while (*parts == ' ') ++parts;
+                                       if (*parts == '\0') break;
+                                       end = strchr(parts, ' ');
+                                       if (end) *end = '\0';
+                                       
zend_hash_internal_pointer_reset_ex(params, &pos);
+                                       while 
(zend_hash_get_current_data_ex(params, (void **)&param, &pos) != FAILURE) {
+                                               if ((*param)->paramName &&
+                                                   strcmp(parts, 
(*param)->paramName) == 0) {
+                                               sdlParamPtr x_param;
+                                               x_param = 
emalloc(sizeof(sdlParam));
+                                               *x_param = **param;
+                                               (*param)->paramName = NULL;
+                                               
zend_hash_next_index_insert(&ht, &x_param, sizeof(sdlParamPtr), NULL);
+                                               found = 1;
+                                               break;
+                                               }
+                                               
zend_hash_move_forward_ex(params, &pos);
+                                       }
+                                       if (!found) {
+                                               soap_error1(E_ERROR, "Parsing 
WSDL: Missing part '%s' in <message>", parts);
+                                       }
+                                       parts += strlen(parts);
+                                       if (end) *end = ' ';
+                               }
+                               zend_hash_destroy(params);
+                               *params = ht;
                        }
 
                        if (binding->use == SOAP_ENCODED) {
@@ -1027,7 +1061,7 @@
        return ctx.sdl;
 }
 
-#define WSDL_CACHE_VERSION 0x0a
+#define WSDL_CACHE_VERSION 0x0b
 
 #define WSDL_CACHE_GET(ret,type,buf)   memcpy(&ret,*buf,sizeof(type)); *buf += 
sizeof(type);
 #define WSDL_CACHE_GET_INT(ret,buf)    ret = ((unsigned 
char)(*buf)[0])|((unsigned char)(*buf)[1]<<8)|((unsigned 
char)(*buf)[2]<<16)|((int)(*buf)[3]<<24); *buf += 4;
@@ -1275,7 +1309,6 @@
                body->encodingStyle = SOAP_ENCODING_DEFAULT;
        }
        body->ns = sdl_deserialize_string(in);
-       body->parts = sdl_deserialize_string(in);
        WSDL_CACHE_GET_INT(i, in);
        if (i > 0) {
                body->headers = emalloc(sizeof(HashTable));
@@ -1876,7 +1909,6 @@
                WSDL_CACHE_PUT_1(body->encodingStyle, out);
        }
        sdl_serialize_string(body->ns, out);
-       sdl_serialize_string(body->parts, out);
        if (body->headers) {
                i = zend_hash_num_elements(body->headers);
        } else {
@@ -2311,9 +2343,6 @@
        if (body.ns) {
                efree(body.ns);
        }
-       if (body.parts) {
-               efree(body.parts);
-       }
        if (body.headers) {
                zend_hash_destroy(body.headers);
                efree(body.headers);
http://cvs.php.net/diff.php/php-src/ext/soap/php_sdl.h?r1=1.31.2.2&r2=1.31.2.3&ty=u
Index: php-src/ext/soap/php_sdl.h
diff -u php-src/ext/soap/php_sdl.h:1.31.2.2 php-src/ext/soap/php_sdl.h:1.31.2.3
--- php-src/ext/soap/php_sdl.h:1.31.2.2 Tue Nov  9 03:13:04 2004
+++ php-src/ext/soap/php_sdl.h  Mon Mar 21 10:57:16 2005
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_sdl.h,v 1.31.2.2 2004/11/09 08:13:04 dmitry Exp $ */
+/* $Id: php_sdl.h,v 1.31.2.3 2005/03/21 15:57:16 dmitry Exp $ */
 
 #ifndef PHP_SDL_H
 #define PHP_SDL_H
@@ -109,7 +109,6 @@
 struct _sdlSoapBindingFunctionBody {
        char                *ns;
        sdlEncodingUse       use;
-       char                *parts;          /* not implemented yet */
        sdlRpcEncodingStyle  encodingStyle;  /* not implemented yet */
        HashTable           *headers;        /* array of 
sdlSoapBindingFunctionHeaderPtr */
 };

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to