NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
XML error parsing WSDL on line 2: Invalid document end, HELP


Joined: 02 Mar 2007
Posts: 5
Location: Newcastle
Reply with quote
I've once again found the need to post on this forum!

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://mywebserver/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://mywebserver/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://mywebserver/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://mywebserver/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,

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

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
your server code produces E_NOTICE and it makes WSDL wrong from the XML standard perspectives:

<br />
<b>Notice</b>: Undefined index: HTTPS in <b>/export/web/homepages.cs/jonathan.olliff-lee/WebServices/MessagingWebService/lib/nusoap.php</b> on line <b>4006</b><br />

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
???


Joined: 02 Mar 2007
Posts: 5
Location: Newcastle
Reply with quote
Thanks dimitri!

But i'm afraid I have no idea what that means or how to fix it!

Cheers,

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

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
you may want to update php.ini. Turn display error off and enable error reporting to a log.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
XML error parsing WSDL on line 2: Invalid document end, HELP
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