Jump to content

Odys

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by Odys

  1. I had error with clashes between NuSOAP & PHP_SOAP extension but they have now been resolved ( i think) by changing 'soapclient' to 'sclient' in nusoap.php However now I have new errors, namely: Constructor error: wsdl error: XML error parsing WSDL from http://homepages.cs.ncl.ac.uk/jonathan.olliff-lee/WebServices/MessagingWebService/MessagingServer.php?wsdl on line 2: Invalid document end and Error: XML error parsing SOAP payload on line 2: Invalid document end This both appear on the client page http://homepages.cs.ncl.ac.uk/jonathan.olliff-lee/WebServices/MessagingWebService/MessagingClient.php, the server however throws a different error: Notice: Undefined index: HTTPS in /export/web/homepages.cs/jonathan.olliff-lee/WebServices/MessagingWebService/nusoap.php on line 4006 This can be seen at : http://homepages.cs.ncl.ac.uk/jonathan.olliff-lee/WebServices/MessagingWebService/MessagingServer.php The client source is: Code: <?php // Pull in the NuSOAP code require_once('nusoap.php'); // Create the client instance $client = new sclient('http://homepages.cs.ncl.ac.uk/jonathan.olliff-lee/WebServices/MessagingWebService/MessagingServer.php?wsdl', true); // Check for an error $err = $client->getError(); if ($err) { // Display the error echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; // At this point, you know the call that follows will fail } // Call the SOAP method $result = $client->call('school', array('school' => 'Computer Science')); // Check for a fault if ($client->fault) { echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>'; } else { // Check for errors $err = $client->getError(); if ($err) { // Display the error echo '<h2>Error</h2><pre>' . $err . '</pre>'; } else { // Display the result echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>'; } } // Display the request and response echo '<h2>Request</h2>'; echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>'; echo '<h2>Response</h2>'; echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>'; // Display the debug messages echo '<h2>Debug</h2>'; echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>'; ?> and the server source is: Code: <?php // Pull in the NuSOAP code require('nusoap.php'); // Create the server instance $server = new soap_server(); // Initialize WSDL support $server->configureWSDL('MessageWebServicewsdl', 'urn:MessageWebServicewsdl'); // Register the method to expose $server->register ( "school", // Method name array('school' => 'xsd:string'), // input parameters array('return' => 'xsd:string'), 'urn:MessageWebServicewsdl', 'urn:MessageWebServicewsdl#school', 'rpc', 'encoded', 'Uses the School to find email addresses in the database' ); // Define The Method As a PHP Function function school($school) { $conn = mysql_connect('host', 'user', 'password') or die ('Error connecting to mysql'); mysql_select_db('database'); $query="SELECT * FROM student WHERE school='$school'"; $result=mysql_query($query); $rows=mysql_num_rows($result); $i=0; while ($i < $rows) { $name = mysql_result($result, $i, 'name'); $email = mysql_result($result, $i, 'email'); $school = mysql_result($result, $i, 'school'); echo $name; echo $school; $message = "Hello $name, This Is A Test Email"; mail($email, 'Test E-Mail', $message); $i++; } mysql_close($conn); return 'Message sent to all students in the school of ' . $school; } // Use the request to (try to) invoke the service $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?> Any help understanding this / finding a solution would be much appreciated! Many thanks,
  2. Hi everyone! I'm using NuSOAP, and it has been working fine until today when I got the following error! Fatal error: Cannot redeclare class soapclient in /export/web/homepages.cs/jonathan.olliff-lee/WebServices/MessagingWebService/nusoap.php on line 7240 I have touched nusoap.php so its as is when you download it! I have no idea whats going on and was just wondering whether anyone has had this problem before or know of a solution! Many thanks!
  3. Hi! I posted a problem here a couple of days ago that had nothing to do with NuSOAP in the end! However this one I belive maybe being caused by NuSOAP. I get the following error when I try to invoke a service.... XML error parsing SOAP payload on line 1: Empty document The code is designed to send an email which it does despite the error, however I cant seem to find why i'm getting the error. The main body of the function is $query="SELECT * FROM student WHERE school='$school'"; $result=mysql_query($query); $rows=mysql_num_rows($result); $i=0; while ($i < $rows) { $name = mysql_result($result, $i, "name"); $email = mysql_result($result, $i, "email"); $school = mysql_result($result, $i, "school"); echo $name . "<br />"; echo $school . "<br />"; $message = "Hello '$name', Well despite some errors showing, it does actually work!"; mail($email, 'Test E-Mail', $message); $i++; } mysql_close($conn); return 'Message sent to all students in the school of ' . $school; Can anyone help with this? Cheers....
  4. Solved the problem by changing: $query="SELECT $school FROM student"; to $query="SELECT * FROM student WHERE school='$school'";
  5. yer i tried and got the following error.... wsdl error: XML error parsing WSDL from http://homepages.cs.ncl.ac.uk/jonathan.olliff-lee/WebServices/MessagingWebService/MessagingServer.php?wsdl on line 2: Invalid document end I removed the loop and jus tried to echo record 0
  6. thanks for the advice, just didnt think about it! password has been changed now anyways! there is nothing of any interest in the DB anyways! Cheers!
  7. Hi everyone, I'm a relative noob to PHP and MySQL, and especially to NuSOAP. Well after a few tutorials on using NuSOAP I managed to construct a Client and a Server, both of which work fine until I tried to use MySQL in the functions that would make up the WebService. The client code is working fine (i've tested it with simple hello world messages and it works). Its the server code which is the issue and is displayed below: <?php // Pull in the NuSOAP code require_once('nusoap.php'); // Create the server instance $server = new soap_server(); // Initialize WSDL support $server->configureWSDL('MessageWebServicewsdl', 'urn:MessageWebServicewsdl'); // Register the method to expose $server->register ( 'school', // Method name array('school' => 'xsd:string'), // input parameters array('return' => 'xsd:string'), 'urn:MessageWebServicewsdl', 'urn:MessageWebServicewsdl#school', 'rpc', 'encoded', 'Uses the School to find email addresses in the database' ); // Define The Method As a PHP Function function School($school) { $conn = mysql_connect('homepages.cs.ncl.ac.uk', 'a3101902', 'messWebService') or die ('Error connecting to mysql'); mysql_select_db('a3101902'); $query="SELECT $school FROM student"; $result=mysql_query($query); $rows=mysql_num_rows($result); $i=0; while ($i <= 1)//($i < $rows) { $name = mysql_result($result, $i, "name"); $email = mysql_result($result, $i, "email"); $school = mysql_result($result, $i, "school"); echo $name; echo $school; $message = "Hello $name, This Is A Test Email"; mail($email, 'Test E-Mail', $message); $i++; } return 'Message sent to all students in the school of ' . $school; mysql_close($conn); } // Use the request to (try to) invoke the service $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?> As the code is I get the following error.... XML error parsing SOAP payload on line 2: Invalid document end ??? This can viewed live at http://homepages.cs.ncl.ac.uk/jonathan.olliff-lee/WebServices/MessagingWebService/ForForumViewing/MessagingClient.php If I comment out the lines: $rows=mysql_num_rows($result); and $name = mysql_result($result, $i, "name"); ... through ... to ... mail($email, 'Test E-Mail', $message); Then everything works fine! So i'm guessing the problem is in these lines? Can anyone help? Cheers! ???
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.