Helfen Sie mit NuSOAP für einen Web-Service

Ich versuche zu tun, ein Beispiel Webservice mit NuSOAP in PHP, und ich baute diese Beispiel-Klasse:

<?php
//Pull in the NuSOAP code
require_once('lib/nusoap.php');
//Create the server instance
$server = new soap_server;
//Register the method to expose
$server->register('hello');
//Define the method as a PHP function
function hello($name) {
    return 'Hello, ' . $name;
}
//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);
?>

und diese Klasse für den client:

<?php
//Pull in the NuSOAP code
require_once('lib/nusoap.php');
//Create the client instance
$client = new soapclient('http://localhost/webServiceResta.php');
//Call the SOAP method
$result = $client->call('hello', array('name' => 'Scott'));
//Display the result
print_r($result);
?>

aber ich glaube, ich bekomme diese Fehlermeldung, wenn ich das Skript ausführen:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost/webServiceResta.php' : Start tag expected, '<' not found in /opt/lampp/htdocs/prueba.php:5 Stack trace: #0 /opt/lampp/htdocs/prueba.php(5): SoapClient->SoapClient('http://localhos...') #1 {main} thrown in /opt/lampp/htdocs/prueba.php on line 5

Bin ich mit XAMPP auf ubuntu installieren, und alle Dateien sind am richtigen Ort.

  • Es war der client-code, in der neuen version wurde umbenannt in nusoap_client();
InformationsquelleAutor Osukaa | 2010-11-18
Schreibe einen Kommentar