Sunday, 8 September 2013

nusoap function calling not showing proper response

nusoap function calling not showing proper response

I have service created as
<?php
require_once('inc/nusoap.php');
$l_oServer = new soap_server();
$l_oServer->debug_flag=false;
$l_oServer->configureWSDL('Register_patient',
'http://localhost/findadoctor/');
$l_oServer->wsdl->schemaTargetNamespace = 'http://localhost/findadoctor/';
$l_oServer->wsdl->addComplexType(
'register_patientdata',
'complexType',
'struct',
'all',
'',
array(
'aid' => array('name'=>'aid', 'type'=>'xsd:string'),
'apwd' => array('name'=>'apwd', 'type'=>'xsd:string'),
'gid' => array('name'=>'gid', 'type'=>'xsd:string'),
'pid' => array('name'=>'pid', 'type'=>'xsd:string'),
'fname' => array('name'=>'fname', 'type'=>'xsd:string'),
'lname' => array('name'=>'lname', 'type'=>'xsd:string'),
'mname' => array('name'=>'mname', 'type'=>'xsd:string'),
'dob' => array('name'=>'dob', 'type'=>'xsd:string')));
$l_oServer->register('register_patient',
array('aid' =>'xsd:string','apwd' =>'xsd:string','gid'
=>'xsd:string','pid' =>'xsd:string','fname'
=>'xsd:string','lname'=>'xsd:string', 'mname'=>'xsd:string',
'dob'=>'xsd:string'),
array('return'=>'tns:Register_patient'),
'http://localhost/Register_patient');
function register_patient($pid) {
if (is_string($pid)) {
$l_oDBlink = @mysql_connect('localhost', 'root', 'asifg');
$l_oDBresult = @mysql_db_query('411findadoctor_main_staging', 'SELECT
* FROM healthproviderpatientid WHERE HP_ID =1 AND HP_Patient_ID =' .
mysql_escape_string((string)$pid));
if (!$l_oDBresult) {
return new soap_fault('Server', '', 'Internal server error.');
}
if (!mysql_num_rows($l_oDBresult)) {
return new soap_fault('Server', '', 'Internal server error.');
}
mysql_close($l_oDBlink);
return 'hello';
}
// we accept only a string else { return new soap_fault('Client', '',
'Service requires a string parameter.'); } }
$l_oServer->service($HTTP_RAW_POST_DATA); ?>
Here is ho i am calling it ?php
/********************************** * Description: * Creates a simple SOAP
Client (client.php). **********************************/
// use form data
if ((string)$_GET['action'] == 'get_data') {
// includes nusoap classes
require_once('inc/nusoap.php');
// set parameters and create client
$l_aParam =
array((string)$_POST['aid'],(string)$_POST['apwd'],(string)$_POST['gid'],(string)$_POST['pid'],
(string)$_POST['fname'],(string)$_POST['lname'],(string)$_POST['mname'],(string)$_POST['dob']);
$l_oClient = new
soapclient('http://localhost/findadoctor/thprenotification.php');
$l_aParamw= array((string)$_POST['aid']);
$l_stResult = $l_oClient->call('exist_patient', $l_aParamw);
//$l_stResult = $l_oClient->call('register_patient', $l_aParam);
// check for errors
if(!$l_stResult)
{
echo "not called";
}
if (!$l_oClient->getError()) {
// print results
echo "<pre>";
echo "no errors";
echo "</pre>";
}
// print error description
else {
echo '<h1>Error: ' . $l_oClient->getError() . '</h1>';
}
}
// output search form
print '
<form name="input" action="'.$_SERVER['PHP_SELF'].'?action=get_data"
method="POST">
Your authorization id: <input type="text" name="aid">
Your authorization pwd: <input type="text" name="apwd">
Your Gid: <input type="text" name="gid">
Your Pid: <input type="text" name="pid">
Your first name: <input type="text" name="fname">
Your middle name: <input type="text" name="mname">
Your Last name name: <input type="text" name="lname">
Your DOB: <input type="text" name="dob">
<input type="submit" value="Search">
</form>
';
?>
the client never gets any results from the server i mean i have tried many
things to get some response from it but it is not working. i want that
function should atleast work right the call should go into the function
but currently it is not going there :(

No comments:

Post a Comment