X_Kalibur
asked on
HTTP_RAW_POST_DATA - non existant
Howdy all
I'm trying to use the NuSOAP library to create an XML-RPC server and then query that using a client.
In reading one of the million tutorials on the issue, it never mentioned the fact that the HTTP_RAW_POST_DATA was even mildly important....
So to cut a long story short, i've now done my research and set the "always_populate_raw_post_ data = On" directive in php.ini, but am still having a problem, where the HTTP_RAW_POST_DATA is not defined
So what can i do?! i'd like to get this going asap, or i'll move over to a more productive platform (Delphi/Kylix)...I like PHP because its already 100% cross platform compatible, whereas Delphi/Kylix still needs some tip-toeing
Thanks!
-Xerxes
I'm trying to use the NuSOAP library to create an XML-RPC server and then query that using a client.
In reading one of the million tutorials on the issue, it never mentioned the fact that the HTTP_RAW_POST_DATA was even mildly important....
So to cut a long story short, i've now done my research and set the "always_populate_raw_post_
So what can i do?! i'd like to get this going asap, or i'll move over to a more productive platform (Delphi/Kylix)...I like PHP because its already 100% cross platform compatible, whereas Delphi/Kylix still needs some tip-toeing
Thanks!
-Xerxes
could you use a basic HTML FORM that has action=source/phpinfo2/php info.php and method=POST and containing some non-empty fields.
This way I think you'll see $*POST_VARS* ;-)
Here, you did a GET : _SERVER["REQUEST_METHOD"] GET
No marvel that POST_VARS is empty 8-))))
This way I think you'll see $*POST_VARS* ;-)
Here, you did a GET : _SERVER["REQUEST_METHOD"] GET
No marvel that POST_VARS is empty 8-))))
ASKER
Hi VGR,
This is the article i followed to try and get it all working:
http://www.zend.com/zend/tut/tutorial-campbell.php#Heading7
Now if i visit the URL of the SOAP server given in the example ( http://www.whytewolf.ca/ws/taxCalc.php ), it returns a proper XML document.
but when i try to visit my implementation of the server, i'm getting the "Undefined Index: HTTP_RAW_POST_DATA", and a malformed XML document, because of PHP injecting this error
NOW.....interestingly enough, if i visit my php CLIENT implementation of the web service, it works fine! it returns output as expected.
So this is pretty weird behviour, unless i am totally mistaken
Whats going on!?!
This is the article i followed to try and get it all working:
http://www.zend.com/zend/tut/tutorial-campbell.php#Heading7
Now if i visit the URL of the SOAP server given in the example ( http://www.whytewolf.ca/ws/taxCalc.php ), it returns a proper XML document.
but when i try to visit my implementation of the server, i'm getting the "Undefined Index: HTTP_RAW_POST_DATA", and a malformed XML document, because of PHP injecting this error
NOW.....interestingly enough, if i visit my php CLIENT implementation of the web service, it works fine! it returns output as expected.
So this is pretty weird behviour, unless i am totally mistaken
Whats going on!?!
ASKER
This is the error message coming from my server, if i try to view the server.php file directly:
<b>Notice</b>: Undefined index: HTTP_RAW_POST_DATA in <b>/var/www/htdocs/source/ webservice s/server.p hp</b> on line <b>58</b><br />
<b>Notice</b>: Undefined index: HTTP_RAW_POST_DATA in <b>/var/www/htdocs/source/
ASKER
and here is a copy of the source code....
--------------
<?php
/**
* taxCalc.php
* An example PHP script which uses NuSOAP to provide a
* tax calculator function.
*
* Created on August 7, 2002, 6:11 PM
* @author Sean Campbell
* @version 1.0
*/
/* Include the NuSOAP library. */
require_once('nusoap.php') ;
/* Create a new SOAP server instance. */
$server = new soap_server;
/* Register the taxCalc function for publication. */
$server->register('taxCalc ');
/**
* Calculates the total (including tax) for a purchase based on the
* rate and subtotal provided.
*
* @param string $rate The tax rate in percent.
* @param string $sub The subtotal for the purchase.
*
* @return float $total The total for the purchase.
*
* @author Sean Campbell
* @version 1.0
*/
function taxCalc ($rate, $sub)
{
if ($rate == '' || $rate <= 0) {
/* Return a SOAP fault indicating a negative or
* zero tax rate was transmitted. */
return new soap_fault(
'Client', '',
'Must supply a positive, non-zero tax rate.',''
);
}
if ($sub == '' || $sub <= 0) {
/* Return a SOAP fault indicating a negative or
* zero subtotal was transmitted. */
return new soap_fault(
'Client', '',
'Must supply a positive, non-zero subtotal.', ''
);
}
/* Return the generated total for the purchase. */
return (($rate / 100) * $sub) + $sub;
}
/* Begin the HTTP listener service and exit. */
//
//
// !!!!!!!!!THIS IS THE CULPRIT LINE!!!!!!!!!!!
$server->service($GLOBALS[ "HTTP_RAW_ POST_DATA" ]);
exit();
?>
--------------
<?php
/**
* taxCalc.php
* An example PHP script which uses NuSOAP to provide a
* tax calculator function.
*
* Created on August 7, 2002, 6:11 PM
* @author Sean Campbell
* @version 1.0
*/
/* Include the NuSOAP library. */
require_once('nusoap.php')
/* Create a new SOAP server instance. */
$server = new soap_server;
/* Register the taxCalc function for publication. */
$server->register('taxCalc
/**
* Calculates the total (including tax) for a purchase based on the
* rate and subtotal provided.
*
* @param string $rate The tax rate in percent.
* @param string $sub The subtotal for the purchase.
*
* @return float $total The total for the purchase.
*
* @author Sean Campbell
* @version 1.0
*/
function taxCalc ($rate, $sub)
{
if ($rate == '' || $rate <= 0) {
/* Return a SOAP fault indicating a negative or
* zero tax rate was transmitted. */
return new soap_fault(
'Client', '',
'Must supply a positive, non-zero tax rate.',''
);
}
if ($sub == '' || $sub <= 0) {
/* Return a SOAP fault indicating a negative or
* zero subtotal was transmitted. */
return new soap_fault(
'Client', '',
'Must supply a positive, non-zero subtotal.', ''
);
}
/* Return the generated total for the purchase. */
return (($rate / 100) * $sub) + $sub;
}
/* Begin the HTTP listener service and exit. */
//
//
// !!!!!!!!!THIS IS THE CULPRIT LINE!!!!!!!!!!!
$server->service($GLOBALS[
exit();
?>
Sorry, I can't help you.
First it's SOAP which I never use
Then HTTP_RAW_POST_DATA I never saw, I use HTTP_POST_VARS
My guess is that the server implementation is different from what you call "client side impl." in that the configuration of the web server are different.
good luck
First it's SOAP which I never use
Then HTTP_RAW_POST_DATA I never saw, I use HTTP_POST_VARS
My guess is that the server implementation is different from what you call "client side impl." in that the configuration of the web server are different.
good luck
ASKER
and here is a copy of the source code....
--------------
<?php
/**
* taxCalc.php
* An example PHP script which uses NuSOAP to provide a
* tax calculator function.
*
* Created on August 7, 2002, 6:11 PM
* @author Sean Campbell
* @version 1.0
*/
/* Include the NuSOAP library. */
require_once('nusoap.php') ;
/* Create a new SOAP server instance. */
$server = new soap_server;
/* Register the taxCalc function for publication. */
$server->register('taxCalc ');
/**
* Calculates the total (including tax) for a purchase based on the
* rate and subtotal provided.
*
* @param string $rate The tax rate in percent.
* @param string $sub The subtotal for the purchase.
*
* @return float $total The total for the purchase.
*
* @author Sean Campbell
* @version 1.0
*/
function taxCalc ($rate, $sub)
{
if ($rate == '' || $rate <= 0) {
/* Return a SOAP fault indicating a negative or
* zero tax rate was transmitted. */
return new soap_fault(
'Client', '',
'Must supply a positive, non-zero tax rate.',''
);
}
if ($sub == '' || $sub <= 0) {
/* Return a SOAP fault indicating a negative or
* zero subtotal was transmitted. */
return new soap_fault(
'Client', '',
'Must supply a positive, non-zero subtotal.', ''
);
}
/* Return the generated total for the purchase. */
return (($rate / 100) * $sub) + $sub;
}
/* Begin the HTTP listener service and exit. */
//
//
// !!!!!!!!!THIS IS THE CULPRIT LINE!!!!!!!!!!!
$server->service($GLOBALS[ "HTTP_RAW_ POST_DATA" ]);
exit();
?>
--------------
<?php
/**
* taxCalc.php
* An example PHP script which uses NuSOAP to provide a
* tax calculator function.
*
* Created on August 7, 2002, 6:11 PM
* @author Sean Campbell
* @version 1.0
*/
/* Include the NuSOAP library. */
require_once('nusoap.php')
/* Create a new SOAP server instance. */
$server = new soap_server;
/* Register the taxCalc function for publication. */
$server->register('taxCalc
/**
* Calculates the total (including tax) for a purchase based on the
* rate and subtotal provided.
*
* @param string $rate The tax rate in percent.
* @param string $sub The subtotal for the purchase.
*
* @return float $total The total for the purchase.
*
* @author Sean Campbell
* @version 1.0
*/
function taxCalc ($rate, $sub)
{
if ($rate == '' || $rate <= 0) {
/* Return a SOAP fault indicating a negative or
* zero tax rate was transmitted. */
return new soap_fault(
'Client', '',
'Must supply a positive, non-zero tax rate.',''
);
}
if ($sub == '' || $sub <= 0) {
/* Return a SOAP fault indicating a negative or
* zero subtotal was transmitted. */
return new soap_fault(
'Client', '',
'Must supply a positive, non-zero subtotal.', ''
);
}
/* Return the generated total for the purchase. */
return (($rate / 100) * $sub) + $sub;
}
/* Begin the HTTP listener service and exit. */
//
//
// !!!!!!!!!THIS IS THE CULPRIT LINE!!!!!!!!!!!
$server->service($GLOBALS[
exit();
?>
Are you using the correct sort of client?
I have installed nusoap on my wintel box and use the following script ...
<html>
<head>
<title>Tax calculator Client</title>
</head>
<body>
<h1>Tax calculated:</h1>
<?php
/**
* taxCalcClient.php
* An example PHP script which uses NuSOAP to access
* a tax calculator function.
*
* Created on August 7, 2002, 6:11 PM
* @author Sean Campbell
* @version 1.0
*/
/* Include the NuSOAP library. */
require_once('./lib/nusoap .php');
/* Initialize the client's parameter list. */
$param = array('rate' => $_GET['rate'],
'sub' => $_GET['sub']
);
/* Create a new client by providing the endpoint to the
* constructor. */
$client = new soapclient(
'http://www.whytewolf.ca/ws/taxCalc.php'
);
/* Call the taxCalc() function, passing the parameter list. */
$response = $client->call('taxCalc', $param);
/* handle any SOAP faults. */
if ($client->fault) {
echo "FAULT: <p>Code: {$client->faultcode}<br />";
echo "String: {$client->faultstring}";
} else {
echo "$" . $response;
}
?>
</body>
</html>
calling ...
taxcalcclient.php?rate=17. 5&sub=100
and I get back ...
Tax calculated:
$117.5
which is correct.
If you get this working, then the class is installed correctly and is working as a client.
Richard.
I have installed nusoap on my wintel box and use the following script ...
<html>
<head>
<title>Tax calculator Client</title>
</head>
<body>
<h1>Tax calculated:</h1>
<?php
/**
* taxCalcClient.php
* An example PHP script which uses NuSOAP to access
* a tax calculator function.
*
* Created on August 7, 2002, 6:11 PM
* @author Sean Campbell
* @version 1.0
*/
/* Include the NuSOAP library. */
require_once('./lib/nusoap
/* Initialize the client's parameter list. */
$param = array('rate' => $_GET['rate'],
'sub' => $_GET['sub']
);
/* Create a new client by providing the endpoint to the
* constructor. */
$client = new soapclient(
'http://www.whytewolf.ca/ws/taxCalc.php'
);
/* Call the taxCalc() function, passing the parameter list. */
$response = $client->call('taxCalc', $param);
/* handle any SOAP faults. */
if ($client->fault) {
echo "FAULT: <p>Code: {$client->faultcode}<br />";
echo "String: {$client->faultstring}";
} else {
echo "$" . $response;
}
?>
</body>
</html>
calling ...
taxcalcclient.php?rate=17.
and I get back ...
Tax calculated:
$117.5
which is correct.
If you get this working, then the class is installed correctly and is working as a client.
Richard.
I am trying it locally and getting ...
<html>
<head>
<title>Tax calculator Client</title>
</head>
<body>
<h1>Tax calculated:</h1>
$
</body>
</html>
Which is better than an error! But only just!.
<html>
<head>
<title>Tax calculator Client</title>
</head>
<body>
<h1>Tax calculated:</h1>
$
</body>
</html>
Which is better than an error! But only just!.
ASKER
RQuadling - thats what i get from the client, too!
have you tried visiting the page for your server directly - it shoiuld return a botched up XML document.
have you tried visiting the page for your server directly - it shoiuld return a botched up XML document.
ASKER
hello!?
anyone got further advice?!
anyone got further advice?!
If I call the taxcalc.php file directly (rather than through the client), I get ...
<b>Notice</b>: Undefined index: HTTP_RAW_POST_DATA in <b>C:\Personal\WebSites\PF L\public_h tml\taxcal c.php</b> on line <b>61</b><br />
Which is not good!
Hmmmm.
Try removing _RAW ?
Richard.
<b>Notice</b>: Undefined index: HTTP_RAW_POST_DATA in <b>C:\Personal\WebSites\PF
Which is not good!
Hmmmm.
Try removing _RAW ?
Richard.
ASKER
Richard,
AFAIK and from what i've read, it needs to use the HTTP_RAW_POST_DATA to extract the SOAP XML from the http request.
But the behaviour you just described is exactly what i'm getting!
*sigh*
i wonder wtf is going on? possibly register_globals??
-Xerxes
AFAIK and from what i've read, it needs to use the HTTP_RAW_POST_DATA to extract the SOAP XML from the http request.
But the behaviour you just described is exactly what i'm getting!
*sigh*
i wonder wtf is going on? possibly register_globals??
-Xerxes
Nope.
What I would like to know is what is the format of HTTP_RAW_POST_DATA?
$HTTP_POST_VARS / $_POST or $HTTP_GET_VARS / $_GET ?
I cannot find any references to HTTP_RAW_POST_DATA that have not been discussed here.
How about emailing the original code writer?
Richard.
What I would like to know is what is the format of HTTP_RAW_POST_DATA?
$HTTP_POST_VARS / $_POST or $HTTP_GET_VARS / $_GET ?
I cannot find any references to HTTP_RAW_POST_DATA that have not been discussed here.
How about emailing the original code writer?
Richard.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In my PHP.INI file ...
; Always populate the $HTTP_RAW_POST_DATA variable.
always_populate_raw_post_d ata = On
Not sure if this is on for all servers.
Richard.
; Always populate the $HTTP_RAW_POST_DATA variable.
always_populate_raw_post_d
Not sure if this is on for all servers.
Richard.
ASKER
----------
PHP Variables
Variable Value
_SERVER["AUTH_TYPE"] Basic
_SERVER["DOCUMENT_ROOT"] /var/www/htdocs
_SERVER["HTTP_ACCEPT"] image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpo
_SERVER["HTTP_ACCEPT_LANGU
_SERVER["HTTP_CACHE_CONTRO
_SERVER["HTTP_CONNECTION"]
_SERVER["HTTP_HOST"] xerxesb.no-ip.org
_SERVER["HTTP_USER_AGENT"]
_SERVER["HTTP_VIA"] 1.0 smokescreen.dataforce.com.
_SERVER["HTTP_X_FORWARDED_
_SERVER["PATH"] /sbin:/usr/sbin:/bin:/usr/
_SERVER["REMOTE_ADDR"] 203.63.31.130
_SERVER["REMOTE_PORT"] 1487
_SERVER["REMOTE_USER"] xerxes
_SERVER["SCRIPT_FILENAME"]
_SERVER["SERVER_ADDR"] 192.168.0.200
_SERVER["SERVER_ADMIN"] xerxes.d.battiwalla@uts.ed
_SERVER["SERVER_NAME"] xerxesb.no-ip.org
_SERVER["SERVER_PORT"] 80
_SERVER["SERVER_SIGNATURE"
_SERVER["SERVER_SOFTWARE"]
_SERVER["GATEWAY_INTERFACE
_SERVER["SERVER_PROTOCOL"]
_SERVER["REQUEST_METHOD"] GET
_SERVER["QUERY_STRING"]
_SERVER["REQUEST_URI"] /source/phpinfo2/phpinfo.p
_SERVER["SCRIPT_NAME"] /source/phpinfo2/phpinfo.p
_SERVER["PATH_TRANSLATED"]
_SERVER["PHP_SELF"] /source/phpinfo2/phpinfo.p