Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 16th, 2007, 04:11 PM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default NuSOAP Help : XML error parsing WSDL on line 2

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/jonath...erver.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/jonath...gingClient.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/jonath...gingServer.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,

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML parsing: line 1, character 38, unable to switc prafullaborade XML 2 May 22nd, 2008 06:21 AM
Error in php xml parsing... caught PHP How-To 0 April 12th, 2007 03:54 AM
NuSoap WSDL help!!! kenson PHP How-To 0 November 23rd, 2006 02:03 AM
JSTL XML parsing error pankajbrathi JSP Basics 1 August 29th, 2006 07:35 AM
XML Parsing error: require </META> disaacs XSLT 1 August 6th, 2004 01:58 PM



All times are GMT -4. The time now is 05:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.