nadman123 Posted October 1, 2008 Share Posted October 1, 2008 hello guyz.. I m trying to get this webservice done but i cant do it can you please help me out.... here is the code of the CustomerServer.php <?php // Pull in the NuSOAP code require_once('lib/nusoap.php'); // create SOAP server object $server = new soap_server(); // Define the methods as a PHP functions function getCustomers() { include("connection.php"); $conn = oci_connect($UName, $PWord, $DB); $query="SELECT * FROM customer"; $stmt = oci_parse($conn, $query); oci_execute($stmt); oci_fetch_all($stmt, $rows, 0, 0,OCI_FETCHSTATEMENT_BY_ROW); oci_free_statement($stmt); oci_close($conn); return $rows; } function getCustomerByID($params) { include("connection.php"); $conn = oci_connect($UName, $PWord, $DB); $query="SELECT * FROM customer WHERE cust_no =".$params[0]; $stmt = oci_parse($conn, $query); oci_execute($stmt); $row = oci_fetch_array ($stmt); oci_free_statement($stmt); oci_close($conn); return $row; } function updateCustomer($params) { include("connection.php"); $conn = oci_connect($UName, $PWord, $DB); $query="UPDATE Customer set firstname='".$params[1]."',". "surname='".$params[2]."', address='".$params[3]."',". "contact='".$params[4]."' WHERE cust_no =".$params[0]; $stmt = oci_parse($conn, $query); oci_execute($stmt); oci_free_statement($stmt); oci_close($conn); } function deleteCustomer($params) { include("connection.php"); $conn = oci_connect($UName, $PWord, $DB); $query="DELETE FROM customer WHERE cust_no =".$params[0]; $stmt = oci_parse($conn, $query); oci_execute($stmt); oci_free_statement($stmt); oci_close($conn); } // Use the request to (try to) invoke the service $server->register('getCustomers'); $server->register('getCustomerByID'); $server->register('updateCustomer'); $server->register('deleteCustomer'); $server->service(file_get_contents("php://input")); ?> here is the code of the CustomerClient.php <?php require_once('lib/nusoap.php'); // Create the client instance $client = new soapclient('http://localhost/CustomerServer.php'); $result = $client->call('getCustomers'); // Check for an error $err = $client->getError(); if ($err) { echo '<p><b>error: ' . $err . '</b></p>'; } else { print_r($result); echo "<p />"; ?> <table border="1" align="center"> <tr> <th>Cust No</th> <th>Firstname</th> <th>Surname</th> <th>Address</th> <th>Contact</th> </tr> <?php foreach($result as $Row) { echo "<tr>"; foreach($Row as $Data) { echo "<td>".$Data."</td>"; } echo "</tr>"; } echo "</table>"; } ?> I m getting this error error: Response not of type text/xml: text/html What should I do Please help all you PHP experts... Link to comment https://forums.phpfreaks.com/topic/126557-nusoap-web-service-help/ Share on other sites More sharing options...
nadman123 Posted October 1, 2008 Author Share Posted October 1, 2008 why no ones helping me... Link to comment https://forums.phpfreaks.com/topic/126557-nusoap-web-service-help/#findComment-655169 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.