logo       

Re: HTTP_RAW_POST_DATA Strangeness: msg#00076

php.nusoap.general

Subject: Re: HTTP_RAW_POST_DATA Strangeness

Hi Scott,

I understand what you wrote, but I still don't understand why this works:

$HTTP_RAW_POST_DATA = @$HTTP_RAW_POST_DATA ? $HTTP_RAW_POST_DATA : $_POST;
$server->service($HTTP_RAW_POST_DATA);

and this doesn't (since $HTTP_RAW_POST_DATA is undefined):

$server->service($_POST);

John



You are correct: service($data) does not care where the $data comes from. That means, for instance, that it is possible to write a test harness that calls service with $data read from a file.

For an HTTP GET, service ignores $data and returns the WSDL or the documentation page. For an HTTP POST, service assumes it is handling a SOAP call, so $data must be a SOAP envelope. It is your job to provide service with that SOAP envelope. Normally, the body of the HTTP POST is the envelope, which is why programmers typically use $HTTP_RAW_POST_DATA. If your PHP configuration prevents you from using $HTTP_RAW_POST_DATA, you must find an alternative way to get the data that service needs.

If you are using PHP 4.3.0 or later, you can use the php://input stream.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message -----
To: <nusoap-general@xxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, April 21, 2004 6:00 PM
Subject: [Nusoap-general] HTTP_RAW_POST_DATA Strangeness


Hello,

I am having a strange problem that seems to be based on a setting in
php.ini: always_populate_raw_post_data=On vs Off

If this value is not set to On (which I have no control over at a shared
hosting server) the following code will produce a valid WSDL, but when the
service is called it faults with 'xml was empty, didn't parse'.

Works if always_populate_raw_post_data=On:
$server->service($HTTP_RAW_POST_DATA);

Generates correct WSDL for service.php?wsdl:
$server->service($_POST); // generates above fault when called though

Only way it works with =Off:
$HTTP_RAW_POST_DATA = @$HTTP_RAW_POST_DATA ? $HTTP_RAW_POST_DATA : $_POST;
$server->service($HTTP_RAW_POST_DATA);

I can't see where the service($data) would care where the $data came
from in nusoap.php (nor anywhere else $HTTP_RAW_POST_DATA is referenced).

This is with latest CVS nusoap.php v 1.72,
John
--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
* We also walk dogs... Dynamic Web Design, PHP/MySQL/Linux/Hosting
* www.steelesoftconsulting.com
*/



-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise