NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
XML error parsing SOAP payload on line 1: Empty document???


Joined: 02 Mar 2007
Posts: 5
Location: Newcastle
Reply with quote
Hi everyone!

I haven't been using NuSOAP for very long. I've created a client and server that both work in terms of the client sends a message with a parameter for a method on the server. The server queries a MySQL database and returns some results, An email is then sent to all the names that were returned from the database.

However!

I get the "XML error parsing SOAP payload on line 1: Empty document", and I have no idea of how to get rid of it! The code for the server is:

Code:

<?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('databaselocation', 'username', 'password') or die ('Error connecting to mysql');
   mysql_select_db('databasename') or die ('Unable to find 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 . "<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;   
}

// 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 would be much appreciated!

Cheers, Jonny...
View user's profileFind all posts by JonnySend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Empty payload means that payload was empty and therefore no soap protocol took place. I'd recommend you to check if you invoke your soap service with a correct url and this url generates correct WSDL output.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
XML error parsing SOAP payload on line 1: Empty document???
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic