24-05-2007, 20:17
|
|
|
חבר מתאריך: 21.02.07
הודעות: 26
|
|
בעייה ב WEB SERVICES
שלום צריך את עזרתכם אני כותב קוד בשימוש ב nusoap
I am getting an erro :
Fault: Array ( [faultcode] => Client [faultactor] => [faultstring] => Operation 'joinparams' is not defined in the WSDL for this service [detail] => )
מישהו יכול לעזור לי
תודה רבה
מצורף קוד
server.php
<?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('joinparams');
// Define the method as a PHP function
function joinparams($s, $i, $f, $b) {
$ret = $s . ' is a ' . gettype($s);
$ret .= ' ' . $i . ' is a ' . gettype($i);
$ret .= ' ' . $f . ' is a ' . gettype($f);
$ret .= ' ' . $b . ' is a ' . gettype($b);
return new soapval('return', 'xsd:string', $ret);
}
// 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);
?>
client.php
<?php
// Pull in the NuSOAP code
require_once(lib\nusoap.php);
// Create the client instance
$client = new soapclient('http://localhost/server.php');
// Call the SOAP method
$result = $client->call(
'joinparams',
array('s' => 'foo', 'i' => 21, 'f' => 43.21, 'b' => true)
);
// Check for a fault
if ($client->fault) {
echo '<p><b>Fault: ';
print_r($result);
echo '</b></p>';
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo '<p><b>Error: ' . $err . '</b></p>';
} else {
// Display the result
print_r($result);
}
}
?>
|