InsertPatient web service: Can i create a service class without taking any parameters from the client?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hello everyone!

I d like to create a php web service that insert a patient to the db, using
SOAP and WSDL.
Can i create a php class to be consumed without taking any parameters from
the client?
For example:

A client including a form  like this:

....
<p align="center" valign="top">
	<form name="addP" action="index.php?type=addPatientToDB" method="POST"
onSubmit="return check(this);">
		<table align="center" width="500px" border="1">
			<tr>
				<td colspan="2" align="center"><h2>Προσθήκη Ασθενή</h2></td>
			</tr>
			<tr>
				<td>FName :</td>
				<td><input name="firstname" type="text" size="50"></td>
			</tr>
			<tr>
				<td>LName:</td>
				<td><input name="lastname" type="text" size="50"></td>
			</tr>
			<tr>
				<td>Identity :</td>
				<td><input name="identity" type="text" size="50"></td>
		     </tr>
			<tr>
				<td align="center"><input type="reset" name="reset" value="Clear"></td>
				<td align="center"><input type="submit" name="submit"
value="Submit"></td>
			</tr>
		</table>
	</form>
</p>
....
....
$client=new SoapClient($wsdl);
$client->insertPatient();



and a handler class (service) like this:

<?php
Class MyClass {
function insertPatient{

if($_POST["firstname"] != "" && $_POST["lastname"] != "" &&
$_POST["identity"] != "" ){
		$db = "mydb";
		$sql = "INSERT INTO patients (userid, firstname, lastname, identity)
VALUES (" . $_SESSION["userid"] . ", '" . $_POST["firstname"] . "', '" .
$_POST["lastname"] . "', '" . $_POST["identity"] . "') ";
		include($folder["query"]);
	}
	else{
		die("Please insert all info");
	}


echo("<script type=\"text/javascript\" language=\"Javascript\">
<!--
	window.open('index.php?type=showPatients&identity=" . $_POST["identity"] .
"', '_self');
-->
</script>");
}
?>



server 

require_once "MyClass.php";
$wsdl=......
$srv=new SoapServer($wsdl);
$srv->setClass("MyClass");
$srv->handle();


Thank you!

-- 
View this message in context: http://old.nabble.com/InsertPatient-web-service%3A-Can-i-create-a-service-class-without-taking-any-parameters-from-the-client--tp27297678p27297678.html
Sent from the Php - Soap mailing list archive at Nabble.com.


-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux