SoapServer->handle()

(no version information, might be only in CVS)

SoapServer->handle() --  Handles a SOAP request

说明

class SoapServer {

void handle ( [string soap_request] )

}

Processes a SOAP request, calls necessary functions, and sends a response back.

参数

soap_request

The SOAP request. If this argument is omitted, the request is supposed to be in the $HTTP_RAW_POST_DATA PHP variable.

返回值

无返回值。

范例

例子 1. Some examples

<?php
function test($x)
{
    return
$x;
}

$server = new SoapServer(null, array('uri' => "http://test-uri/"));
$server->addFunction("test");
$server->handle();
?>


add a note add a note User Contributed Notes
ceo at l-i-e dot com
16-Mar-2006 06:55
In PHP5, there seem to be times when handle() doesn't "work" and complains of an Invalid Request.

This may (or may not) be only if you are using WSDL...

The root cause would seem to be that handle() expects to find the SOAP Request XML data in $HTTP_RAW_POST_DATA

However, even turning "on" always_populate_raw_post_data does not seem to fill in that variable.

Thus, you need to do like this, to snag the data from stdin and shove it into the variable handle() expects:

   if (!isset($HTTP_RAW_POST_DATA)){
       $HTTP_RAW_POST_DATA = file_get_contents('php://input');
   }

YMMV