Posted By:
Fan_Val
Posted On:
Thursday, July 27, 2006 02:23 PM
Hi, Here is my problem, I have to create message from a modem to a server. The modem send each minute an Inform, the server must respond it with an InformResponse. If everything was ok, the modem send an empty post and that is my trouble. After receiving the empty post, i have to send something (let's say echo 'else';) but this is not working with the structure I try : ********************** First code ********************** require_once("nusoap/lib/nusoap.php"); include('xml_reboot.php'); function Inform ($DeviceId, $Event, $MaxEnvelopes, $CurrentTime, $RetryCount, $ParameterList) { global $server; return 1; } $server = new soap_server;
More>>
Hi, Here is my problem, I have to create message from a modem to a server. The modem send each minute an Inform, the server must respond it with an InformResponse. If everything was ok, the modem send an empty post and that is my trouble. After receiving the empty post, i have to send something (let's say echo 'else';) but this is not working with the structure I try :
**********************
First code
**********************
require_once("nusoap/lib/nusoap.php");
include('xml_reboot.php');
function Inform ($DeviceId, $Event, $MaxEnvelopes, $CurrentTime, $RetryCount, $ParameterList) {
global $server;
return 1;
}
$server = new soap_server;
$server->namespaces['cwmp']="urn:dslforum-org:cwmp-1-0";
$server->register('Inform');
if ( $_SERVER['REQUEST_METHOD'] == 'POST'){
echo'oui';
if (isset($HTTP_RAW_POST_DATA)){
//first message, Inform
$server->service($HTTP_RAW_POST_DATA);
}
else {
//second message, post empty
echo 'else';
}
else {
echo 'non';}
When I follow tcp stream :
1)Inform
2)InformResponse
3)Post empty
4)noting, it is finished ! whereas I would like echo 'else' or 'non' !!!
**********************
Second code
**********************
function Inform ...
$server = new soap_server;
$server->namespaces['cwmp']="urn:dslforum-org:cwmp-1-0";
$server->register('Inform');
if ( $_SERVER['REQUEST_METHOD'] == 'POST' and is_array($HTTP_RAW_POST_DATA) and count($HTTP_RAW_POST_DATA)== '0') {
echo 'oui' ;}
else{
$server->service($HTTP_RAW_POST_DATA);
}
and here 1)2)3) idem
4)HTTP/1.1 500 Internal Server Error
Date: Thu, 27 Jul 2006 15:55:17 GMT
Server: Apache/1.3.27 (Unix) PHP/4.4.2
X-Powered-By: PHP/4.4.2
Status: 500 Internal Server Error
X-SOAP-Server: NuSOAP/0.7.2 (1.94)
Content-Length: 680
Connection: close
Content-Type: text/xml; charset=ISO-8859-1
with
Client
error in msg parsing:
xml was empty, didn't parse!
Thanks for helping
Fan