dmitry          Wed Apr 20 06:58:39 2005 EDT

  Added files:                 (Branch: PHP_5_0)
    /php-src/ext/soap/tests/bugs        bug32776.phpt bug32776.wsdl 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/soap   php_packet_soap.c soap.c 
  Log:
  Fixed bug #32776 (SOAP doesn't support one-way operations)
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.335&r2=1.1760.2.336&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1760.2.335 php-src/NEWS:1.1760.2.336
--- php-src/NEWS:1.1760.2.335   Tue Apr 19 18:14:45 2005
+++ php-src/NEWS        Wed Apr 20 06:58:34 2005
@@ -6,6 +6,7 @@
 - Changed sha1_file() and md5_file() functions to use streams instead of
   low level IO. (Uwe)
 - Fixed memory corruption in ImageTTFText() with 64bit systems. (Andrey)
+- Fixed bug #32776 (SOAP doesn't support one-way operations). (Dmitry)
 - Fixed bug #32759 (incorrect determination of default value (COM)). (Wez)
 - Fixed bug #32758 (Cannot access safearray properties in VB6 objects). (Wez)
 - Fixed bug #32755 (Segfault in replaceChild() when DocumentFragment has
http://cvs.php.net/diff.php/php-src/ext/soap/php_packet_soap.c?r1=1.36.2.4&r2=1.36.2.5&ty=u
Index: php-src/ext/soap/php_packet_soap.c
diff -u php-src/ext/soap/php_packet_soap.c:1.36.2.4 
php-src/ext/soap/php_packet_soap.c:1.36.2.5
--- php-src/ext/soap/php_packet_soap.c:1.36.2.4 Tue Mar 22 05:18:47 2005
+++ php-src/ext/soap/php_packet_soap.c  Wed Apr 20 06:58:37 2005
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_packet_soap.c,v 1.36.2.4 2005/03/22 10:18:47 dmitry Exp $ */
+/* $Id: php_packet_soap.c,v 1.36.2.5 2005/04/20 10:58:37 dmitry Exp $ */
 
 #include "php_soap.h"
 
@@ -34,6 +34,11 @@
 
        ZVAL_NULL(return_value);
 
+       /* Response for one-way opearation */
+       if (buffer_size == 0) {
+               return TRUE;
+       }
+
        /* Parse XML packet */
        response = soap_xmlParseMemory(buffer, buffer_size);
 
http://cvs.php.net/diff.php/php-src/ext/soap/soap.c?r1=1.110.2.30&r2=1.110.2.31&ty=u
Index: php-src/ext/soap/soap.c
diff -u php-src/ext/soap/soap.c:1.110.2.30 php-src/ext/soap/soap.c:1.110.2.31
--- php-src/ext/soap/soap.c:1.110.2.30  Wed Apr 20 04:43:53 2005
+++ php-src/ext/soap/soap.c     Wed Apr 20 06:58:37 2005
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: soap.c,v 1.110.2.30 2005/04/20 08:43:53 dmitry Exp $ */
+/* $Id: soap.c,v 1.110.2.31 2005/04/20 10:58:37 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1689,25 +1689,30 @@
        /* Flush buffer */
        php_end_ob_buffer(0, 0 TSRMLS_CC);
 
-       /* xmlDocDumpMemoryEnc(doc_return, &buf, &size, 
XML_CHAR_ENCODING_UTF8); */
-       xmlDocDumpMemory(doc_return, &buf, &size);
-
-       if (size == 0) {
-               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Dump memory failed");
-       }
+       if (doc_return) {
+               /* xmlDocDumpMemoryEnc(doc_return, &buf, &size, 
XML_CHAR_ENCODING_UTF8); */
+               xmlDocDumpMemory(doc_return, &buf, &size);
+
+               if (size == 0) {
+                       php_error_docref(NULL TSRMLS_CC, E_ERROR, "Dump memory 
failed");
+               }       
+
+               sprintf(cont_len, "Content-Length: %d", size);
+               sapi_add_header(cont_len, strlen(cont_len), 1);
+               if (soap_version == SOAP_1_2) {
+                       sapi_add_header("Content-Type: application/soap+xml; 
charset=utf-8", sizeof("Content-Type: application/soap+xml; charset=utf-8")-1, 
1);
+               } else {
+                       sapi_add_header("Content-Type: text/xml; 
charset=utf-8", sizeof("Content-Type: text/xml; charset=utf-8")-1, 1);
+               }
 
-       sprintf(cont_len, "Content-Length: %d", size);
-       sapi_add_header(cont_len, strlen(cont_len), 1);
-       if (soap_version == SOAP_1_2) {
-               sapi_add_header("Content-Type: application/soap+xml; 
charset=utf-8", sizeof("Content-Type: application/soap+xml; charset=utf-8")-1, 
1);
+               xmlFreeDoc(doc_return);
+               php_write(buf, size TSRMLS_CC);
+               xmlFree(buf);
        } else {
-               sapi_add_header("Content-Type: text/xml; charset=utf-8", 
sizeof("Content-Type: text/xml; charset=utf-8")-1, 1);
+               sapi_add_header("HTTP/1.1 202 Accepted", sizeof("HTTP/1.1 202 
Accepted")-1, 1);
+               sapi_add_header("Content-Length: 0", sizeof("Content-Length: 
0")-1, 1);
        }
 
-       xmlFreeDoc(doc_return);
-       php_write(buf, size TSRMLS_CC);
-       xmlFree(buf);
-
 fail:
        SOAP_GLOBAL(soap_version) = old_soap_version;
        SOAP_GLOBAL(encoding) = old_encoding;
@@ -3156,7 +3161,7 @@
                        ns = encode_add_ns(body, fnb->output.ns);
                        if (function->responseName) {
                                method = xmlNewChild(body, ns, 
function->responseName, NULL);
-                       } else {
+                       } else if (function->responseParameters) {
                                method = xmlNewChild(body, ns, 
function->functionName, NULL);
                        }
                }
@@ -3248,6 +3253,7 @@
        xmlNodePtr envelope = NULL, body, param;
        xmlNsPtr ns = NULL;
        int use = SOAP_LITERAL;
+       xmlNodePtr head = NULL;
 
        encode_reset_ns();
 
@@ -3459,7 +3465,6 @@
        } else {
 
                if (headers) {
-                       xmlNodePtr head;
                        soapHeader *h;
 
                        head = xmlNewChild(envelope, ns, "Header", NULL);
@@ -3552,6 +3557,11 @@
                }
        }
 
+       if (function && function->responseName == NULL && 
+           body->children == NULL && head == NULL) {
+               xmlFreeDoc(doc);
+               return NULL;
+       }
        return doc;
 }
 

http://cvs.php.net/co.php/php-src/ext/soap/tests/bugs/bug32776.phpt?r=1.1&p=1
Index: php-src/ext/soap/tests/bugs/bug32776.phpt
+++ php-src/ext/soap/tests/bugs/bug32776.phpt

http://cvs.php.net/co.php/php-src/ext/soap/tests/bugs/bug32776.wsdl?r=1.1&p=1
Index: php-src/ext/soap/tests/bugs/bug32776.wsdl
+++ php-src/ext/soap/tests/bugs/bug32776.wsdl

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

Reply via email to