dmitry Mon Feb 9 02:51:08 2004 EDT
Added files:
/php-src/ext/soap/tests server015.phpt
Modified files:
/php-src/ext/soap readme.html soap.c
Log:
Allowing to pass request to SoapServer::handle direct (not through
$HTTP_RAW_POST_DATA).
http://cvs.php.net/diff.php/php-src/ext/soap/readme.html?r1=1.2&r2=1.3&ty=u
Index: php-src/ext/soap/readme.html
diff -u php-src/ext/soap/readme.html:1.2 php-src/ext/soap/readme.html:1.3
--- php-src/ext/soap/readme.html:1.2 Fri Feb 6 03:01:35 2004
+++ php-src/ext/soap/readme.html Mon Feb 9 02:51:07 2004
@@ -169,7 +169,7 @@
-->
<h4>Table of Contents</h4>
<table border="0">
-<tr><td><a href="#ref.soap.is_soap_fault">is_sopa_fault</a> -- checks if SOAP call
was failed</td></tr>
+<tr><td><a href="#ref.soap.is_soap_fault">is_soap_fault</a> -- checks if SOAP call
was failed</td></tr>
<tr><td><a href="#ref.soap.soapclient.soapclient">SoapClient::SoapClient</a> --
SoapClient constructor</td></tr>
<tr><td><a href="#ref.soap.soapclient.__call">SoapClient::__call</a> -- calls a SOAP
function</td></tr>
<tr><td><a
href="#ref.soap.soapclient.__getlastrequest">SoapClient::__getLastRequest</a> --
returns last SOAP request</td></tr>
@@ -189,7 +189,7 @@
</table>
<a name="ref.soap.is_soap_fault"></a>
-<h2>is_sopa_fault</h2>
+<h2>is_soap_fault</h2>
<p>(PHP 5)</p>
<p>checks if SOAP call was failed</p>
<h3>Description</h3>
@@ -266,7 +266,10 @@
you can simple call SOAP functions as SoapClient methods. It is useful for
nonWSDL mode when 'soapaction' is unknown, 'uri' is differ form default or
when ypu like to send and/or receive SOAP Headers. To check if function call
-is failed check the result with is_soap_fault() function.
+is failed check the result with is_soap_fault() function.<br>
+SOAP function may return one or several values. In the first case __call will
+return just the value of output parameter, in the second it will return
+array with named output parameters.
</p>
<h4>Examples</h4>
<TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php">
@@ -388,12 +391,22 @@
Exports one or more functions for remote clients. To export one function pass
function name into <b>functions</b> parameter as string. To export several
functions pass an array of function names and to export all functions pass
-a special constant <b>SOAP_FUNCTIONS_ALL</b>.
+a special constant <b>SOAP_FUNCTIONS_ALL</b>.<br>
+Functions must receive all input arguments in the same order as defined
+in WSDL file (They should not receive any output parameters as arguments) and
+return one or more values. To return several values they must return array with
+named output parameters.
<h4>Examples</h4>
<TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php">
- $server->addFunction("func");
+ function func($inputString) {
+ return $inputString;
+ }
+ $server->addFunction("echoString");
- $server->addFunction(array("func1","func2"));
+ function echoTwoStrings($inputString1, $inputString2) {
+ return array("outputString1"=>$inputString1,"outputString2"=>$inputString2);
+ }
+ $server->addFunction(array("echoString","echoTwoStrings"));
$server->addFunction(SOAP_FUNCTIONS_ALL);
</PRE></TD></TR></TABLE>
@@ -443,9 +456,10 @@
<p>(PHP 5)</p>
<p>handles a SOAP request</p>
<h3>Description</h3>
-<p>void <b>handle</b>()</p>
+<p>void <b>handle</b>([string soap_envelope])</p>
It processes a SOAP request, call necessary functions, and send response back.
-It assumes request in global <b>$HTTP_RAW_POST_DATA</b> PHP variable.
+It assumes request in input parameter or in global <b>$HTTP_RAW_POST_DATA</b> PHP
variable
+if the argument is omitted.
<h4>Example</h4>
<TABLE BORDER="0" BGCOLOR="#E0E0E0"><TR><TD><PRE CLASS="php">
<?php
http://cvs.php.net/diff.php/php-src/ext/soap/soap.c?r1=1.74&r2=1.75&ty=u
Index: php-src/ext/soap/soap.c
diff -u php-src/ext/soap/soap.c:1.74 php-src/ext/soap/soap.c:1.75
--- php-src/ext/soap/soap.c:1.74 Fri Feb 6 11:52:14 2004
+++ php-src/ext/soap/soap.c Mon Feb 9 02:51:07 2004
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: soap.c,v 1.74 2004/02/06 16:52:14 dmitry Exp $ */
+/* $Id: soap.c,v 1.75 2004/02/09 07:51:07 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1051,12 +1051,17 @@
xmlChar *buf;
HashTable *function_table;
soapHeader *soap_headers;
+ sdlFunctionPtr function;
+ char *arg = NULL;
+ int arg_len;
SOAP_SERVER_BEGIN_CODE();
FETCH_THIS_SERVICE(service);
SOAP_GLOBAL(soap_version) = service->version;
- ZERO_PARAM();
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) ==
FAILURE) {
+ php_error(E_ERROR, "Invalid parameters passed to soapserver:handle");
+ }
INIT_ZVAL(retval);
if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void
**)&server_vars) == SUCCESS) {
@@ -1111,235 +1116,230 @@
}
}
-/* Turn on output buffering... we don't want people print in their methods
- #if PHP_API_VERSION <= 20010901
- if (php_start_ob_buffer(NULL, 0 TSRMLS_CC) != SUCCESS)
- #else
-*/
if (php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC) != SUCCESS) {
-/* #endif */
php_error(E_ERROR,"ob_start failed");
}
- 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)) {
- sdlFunctionPtr function;
-
- doc_request =
soap_xmlParseMemory(Z_STRVAL_PP(raw_post),Z_STRLEN_PP(raw_post));
-
- if (doc_request == NULL) {
- php_error(E_ERROR, "Bad Request");
- }
- if (xmlGetIntSubset(doc_request) != NULL) {
- xmlNodePtr env = get_node(doc_request->children,"Envelope");
- if (env && env->ns) {
- if (strcmp(env->ns->href,SOAP_1_1_ENV_NAMESPACE) == 0)
{
- SOAP_GLOBAL(soap_version) = SOAP_1_1;
- } else if
(strcmp(env->ns->href,SOAP_1_2_ENV_NAMESPACE) == 0) {
- SOAP_GLOBAL(soap_version) = SOAP_1_2;
- }
+ if (ZEND_NUM_ARGS() == 0) {
+ 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)) {
+ doc_request =
soap_xmlParseMemory(Z_STRVAL_PP(raw_post),Z_STRLEN_PP(raw_post));
+ } else {
+ if (!zend_ini_long("always_populate_raw_post_data",
sizeof("always_populate_raw_post_data"), 0)) {
+ php_error(E_ERROR, "PHP-SOAP requires
'always_populate_raw_post_data' to be on please check your php.ini file");
}
- xmlFreeDoc(doc_request);
- php_error(E_ERROR,"DTD are not supported by SOAP");
+ php_error(E_ERROR, "Can't find HTTP_RAW_POST_DATA");
}
+ } else {
+ doc_request = soap_xmlParseMemory(arg,arg_len);
+ }
- old_sdl = SOAP_GLOBAL(sdl);
- SOAP_GLOBAL(sdl) = service->sdl;
- old_soap_version = SOAP_GLOBAL(soap_version);
- function = deseralize_function_call(service->sdl, doc_request,
service->actor, &function_name, &num_params, ¶ms, &soap_version, &soap_headers
TSRMLS_CC);
+ if (doc_request == NULL) {
+ php_error(E_ERROR, "Bad Request");
+ }
+ if (xmlGetIntSubset(doc_request) != NULL) {
+ xmlNodePtr env = get_node(doc_request->children,"Envelope");
+ if (env && env->ns) {
+ if (strcmp(env->ns->href,SOAP_1_1_ENV_NAMESPACE) == 0) {
+ SOAP_GLOBAL(soap_version) = SOAP_1_1;
+ } else if (strcmp(env->ns->href,SOAP_1_2_ENV_NAMESPACE) == 0) {
+ SOAP_GLOBAL(soap_version) = SOAP_1_2;
+ }
+ }
xmlFreeDoc(doc_request);
+ php_error(E_ERROR,"DTD are not supported by SOAP");
+ }
- if (service->type == SOAP_CLASS) {
- soap_obj = NULL;
+ old_sdl = SOAP_GLOBAL(sdl);
+ SOAP_GLOBAL(sdl) = service->sdl;
+ old_soap_version = SOAP_GLOBAL(soap_version);
+ function = deseralize_function_call(service->sdl, doc_request, service->actor,
&function_name, &num_params, ¶ms, &soap_version, &soap_headers TSRMLS_CC);
+ xmlFreeDoc(doc_request);
+
+ if (service->type == SOAP_CLASS) {
+ soap_obj = NULL;
#if HAVE_PHP_SESSION
- /* If persistent then set soap_obj from from the previous
created session (if available) */
- if (service->soap_class.persistance ==
SOAP_PERSISTENCE_SESSION) {
- zval **tmp_soap;
+ /* If persistent then set soap_obj from from the previous created
session (if available) */
+ if (service->soap_class.persistance == SOAP_PERSISTENCE_SESSION) {
+ zval **tmp_soap;
- if (PS(session_status) != php_session_active &&
- PS(session_status) != php_session_disabled) {
- php_session_start(TSRMLS_C);
- }
+ if (PS(session_status) != php_session_active &&
+ PS(session_status) != php_session_disabled) {
+ php_session_start(TSRMLS_C);
+ }
- /* Find the soap object and assign */
- if (zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)),
"_bogus_session_name", sizeof("_bogus_session_name"), (void **) &tmp_soap) == SUCCESS)
{
- soap_obj = *tmp_soap;
- }
+ /* Find the soap object and assign */
+ if (zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)),
"_bogus_session_name", sizeof("_bogus_session_name"), (void **) &tmp_soap) == SUCCESS)
{
+ soap_obj = *tmp_soap;
}
+ }
#endif
- /* If new session or something wierd happned */
- if (soap_obj == NULL) {
- zval *tmp_soap;
- char *class_name;
- int class_name_len;
+ /* If new session or something wierd happned */
+ if (soap_obj == NULL) {
+ zval *tmp_soap;
+ char *class_name;
+ int class_name_len;
- MAKE_STD_ZVAL(tmp_soap);
- object_init_ex(tmp_soap, service->soap_class.ce);
+ MAKE_STD_ZVAL(tmp_soap);
+ object_init_ex(tmp_soap, service->soap_class.ce);
- /* Call constructor */
- class_name_len = strlen(service->soap_class.ce->name);
- class_name = emalloc(class_name_len+1);
- memcpy(class_name,
service->soap_class.ce->name,class_name_len+1);
- if
(zend_hash_exists(&Z_OBJCE_P(tmp_soap)->function_table, php_strtolower(class_name,
class_name_len), class_name_len+1)) {
- zval c_ret, constructor;
+ /* Call constructor */
+ class_name_len = strlen(service->soap_class.ce->name);
+ class_name = emalloc(class_name_len+1);
+ memcpy(class_name,
service->soap_class.ce->name,class_name_len+1);
+ if (zend_hash_exists(&Z_OBJCE_P(tmp_soap)->function_table,
php_strtolower(class_name, class_name_len), class_name_len+1)) {
+ zval c_ret, constructor;
- INIT_ZVAL(c_ret);
- INIT_ZVAL(constructor);
+ INIT_ZVAL(c_ret);
+ INIT_ZVAL(constructor);
- ZVAL_STRING(&constructor,
service->soap_class.ce->name, 1);
- if (call_user_function(NULL, &tmp_soap,
&constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) ==
FAILURE) {
- php_error(E_ERROR, "Error calling
constructor");
- }
- zval_dtor(&constructor);
- zval_dtor(&c_ret);
+ ZVAL_STRING(&constructor,
service->soap_class.ce->name, 1);
+ if (call_user_function(NULL, &tmp_soap, &constructor,
&c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE) {
+ php_error(E_ERROR, "Error calling
constructor");
}
- efree(class_name);
+ zval_dtor(&constructor);
+ zval_dtor(&c_ret);
+ }
+ efree(class_name);
#if HAVE_PHP_SESSION
- /* If session then update session hash with new object
*/
- if (service->soap_class.persistance ==
SOAP_PERSISTENCE_SESSION) {
- zval **tmp_soap_pp;
- if
(zend_hash_update(Z_ARRVAL_P(PS(http_session_vars)), "_bogus_session_name",
sizeof("_bogus_session_name"), &tmp_soap, sizeof(zval *), (void **)&tmp_soap_pp) ==
SUCCESS) {
- soap_obj = *tmp_soap_pp;
- }
- } else {
- soap_obj = tmp_soap;
+ /* If session then update session hash with new object */
+ if (service->soap_class.persistance ==
SOAP_PERSISTENCE_SESSION) {
+ zval **tmp_soap_pp;
+ if
(zend_hash_update(Z_ARRVAL_P(PS(http_session_vars)), "_bogus_session_name",
sizeof("_bogus_session_name"), &tmp_soap, sizeof(zval *), (void **)&tmp_soap_pp) ==
SUCCESS) {
+ soap_obj = *tmp_soap_pp;
}
-#else
+ } else {
soap_obj = tmp_soap;
+ }
+#else
+ soap_obj = tmp_soap;
#endif
- }
+ }
/* function_table = &(soap_obj->value.obj.ce->function_table);*/
- function_table = &((Z_OBJCE_P(soap_obj))->function_table);
+ function_table = &((Z_OBJCE_P(soap_obj))->function_table);
+ } else {
+ if (service->soap_functions.functions_all == TRUE) {
+ function_table = EG(function_table);
} else {
- if (service->soap_functions.functions_all == TRUE) {
- function_table = EG(function_table);
- } else {
- function_table = service->soap_functions.ft;
- }
+ function_table = service->soap_functions.ft;
}
+ }
- doc_return = NULL;
+ doc_return = NULL;
- /* Process soap headers */
- if (soap_headers != NULL) {
- soapHeader *header = soap_headers;
- while (header != NULL) {
- soapHeader *h = header;
+ /* Process soap headers */
+ if (soap_headers != NULL) {
+ soapHeader *header = soap_headers;
+ while (header != NULL) {
+ soapHeader *h = header;
- header = header->next;
- if (h->mustUnderstand && service->sdl && !h->function
&& !h->hdr) {
- soap_server_fault("MustUnderstand","Header not
understood", NULL, NULL TSRMLS_CC);
- }
+ header = header->next;
+ if (h->mustUnderstand && service->sdl && !h->function &&
!h->hdr) {
+ soap_server_fault("MustUnderstand","Header not
understood", NULL, NULL TSRMLS_CC);
+ }
- 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 TSRMLS_CC);
+ 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));
}
- efree(fn_name);
+ } else if (h->mustUnderstand) {
+ soap_server_fault("MustUnderstand","Header not
understood", NULL, NULL TSRMLS_CC);
}
+ 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) {
- call_status = call_user_function(NULL, &soap_obj,
&function_name, &retval, num_params, params TSRMLS_CC);
- if (service->soap_class.persistance !=
SOAP_PERSISTENCE_SESSION) {
- zval_ptr_dtor(&soap_obj);
- }
- } else {
- call_status = call_user_function(EG(function_table),
NULL, &function_name, &retval, num_params, params TSRMLS_CC);
+ 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) {
+ call_status = call_user_function(NULL, &soap_obj,
&function_name, &retval, num_params, params TSRMLS_CC);
+ if (service->soap_class.persistance !=
SOAP_PERSISTENCE_SESSION) {
+ zval_ptr_dtor(&soap_obj);
}
} else {
- php_error(E_ERROR, "Function '%s' doesn't exist",
Z_STRVAL(function_name));
+ call_status = call_user_function(EG(function_table), NULL,
&function_name, &retval, num_params, params TSRMLS_CC);
}
- efree(fn_name);
+ } else {
+ php_error(E_ERROR, "Function '%s' doesn't exist",
Z_STRVAL(function_name));
+ }
+ efree(fn_name);
- if (call_status == SUCCESS) {
- char *response_name;
+ if (call_status == SUCCESS) {
+ char *response_name;
- if (function && function->responseName) {
- response_name = estrdup(function->responseName);
- } else {
- response_name = emalloc(Z_STRLEN(function_name) +
sizeof("Response"));
-
memcpy(response_name,Z_STRVAL(function_name),Z_STRLEN(function_name));
-
memcpy(response_name+Z_STRLEN(function_name),"Response",sizeof("Response"));
- }
- SOAP_GLOBAL(overrides) = service->mapping;
- 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);
+ if (function && function->responseName) {
+ response_name = estrdup(function->responseName);
+ } else {
+ response_name = emalloc(Z_STRLEN(function_name) +
sizeof("Response"));
+
memcpy(response_name,Z_STRVAL(function_name),Z_STRLEN(function_name));
+
memcpy(response_name+Z_STRLEN(function_name),"Response",sizeof("Response"));
}
+ SOAP_GLOBAL(overrides) = service->mapping;
+ 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));
+ }
- SOAP_GLOBAL(soap_version) = old_soap_version;
- SOAP_GLOBAL(sdl) = old_sdl;
-
- /* Flush buffer */
- php_end_ob_buffer(0, 0 TSRMLS_CC);
+ /* Free soap headers */
+ while (soap_headers != NULL) {
+ soapHeader *h = soap_headers;
+ int i;
- /* xmlDocDumpMemoryEnc(doc_return, &buf, &size,
XML_CHAR_ENCODING_UTF8); */
- xmlDocDumpMemory(doc_return, &buf, &size);
+ 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);
+ }
- if (size == 0) {
- php_error(E_ERROR, "Dump memory failed");
- }
+ SOAP_GLOBAL(soap_version) = old_soap_version;
+ SOAP_GLOBAL(sdl) = old_sdl;
- sprintf(cont_len, "Content-Length: %d", size);
- sapi_add_header(cont_len, strlen(cont_len) + 1, 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);
- } else {
- sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"",
sizeof("Content-Type: text/xml; charset=\"utf-8\""), 1);
- }
+ /* Flush buffer */
+ php_end_ob_buffer(0, 0 TSRMLS_CC);
- /* Free Memory */
- if (num_params > 0) {
- for (i = 0; i < num_params;i++) {
- zval_ptr_dtor(¶ms[i]);
- }
- efree(params);
- }
+ /* xmlDocDumpMemoryEnc(doc_return, &buf, &size, XML_CHAR_ENCODING_UTF8); */
+ xmlDocDumpMemory(doc_return, &buf, &size);
- zval_dtor(&function_name);
- xmlFreeDoc(doc_return);
+ if (size == 0) {
+ php_error(E_ERROR, "Dump memory failed");
+ }
- php_write(buf, size TSRMLS_CC);
- xmlFree(buf);
+ sprintf(cont_len, "Content-Length: %d", size);
+ sapi_add_header(cont_len, strlen(cont_len) + 1, 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);
} else {
- if (!zend_ini_long("always_populate_raw_post_data",
sizeof("always_populate_raw_post_data"), 0)) {
- php_error(E_ERROR, "PHP-SOAP requires
'always_populate_raw_post_data' to be on please check your php.ini file");
- }
+ sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"",
sizeof("Content-Type: text/xml; charset=\"utf-8\""), 1);
+ }
- php_error(E_ERROR, "Can't find HTTP_RAW_POST_DATA");
+ /* Free Memory */
+ if (num_params > 0) {
+ for (i = 0; i < num_params;i++) {
+ zval_ptr_dtor(¶ms[i]);
+ }
+ efree(params);
}
+ zval_dtor(&function_name);
+ xmlFreeDoc(doc_return);
+
+ php_write(buf, size TSRMLS_CC);
+ xmlFree(buf);
+
zval_dtor(&retval);
SOAP_SERVER_END_CODE();
http://cvs.php.net/co.php/php-src/ext/soap/tests/server015.phpt?r=1.1&p=1
Index: php-src/ext/soap/tests/server015.phpt
+++ php-src/ext/soap/tests/server015.phpt
--TEST--
SOAP Server 15: passing request to handle()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
function test() {
return "Hello World";
}
$server = new soapserver(null,array('uri'=>"http://testuri.org"));
$server->addfunction("test");
$envelope = <<<EOF
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://soapinterop.org/xsd">
<SOAP-ENV:Body>
<ns1:test xmlns:ns1="http://testuri.org" />
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
EOF;
$server->handle($envelope);
echo "ok\n";
?>
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://testuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:testResponse><return
xsi:type="xsd:string">Hello
World</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
ok
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php