I'm having trouble understanding the process of creating a WebService in PHP.
I created a server which makes the following call:
<?php
require_once "lib/nusoap.php";
$soap = new soap_server;
$soap->configureWSDL('WS-WebCodeFree', 'http://localhost/ws-webcodefree/');
$soap->wsdl->schemaTargetNamespace = 'http://soapinterop.org/xsd/';
$soap->register(
'info',
array(),
array('x' => 'xsd:string'),
'http://soapinterop.org/'
);
$soap->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '');
function info(){
return "WebCodeFree - Desenvolvimento Web.";
}
On the client side:
<?php
include "lib/nusoap.php";
$client = new SoapClient('http://localhost/web-service/ws-webcodefree.php?wsdl');
$result1 = $client->call('info');
It returns me the error:
Fatal error: Uncaught SoapFault exception: [Client] Function ("call") is not a valid method for this service C: \ GitHub \ voxy \ app \ return \ index.php: 3 Stack trace: # 0 C: \ GitHub \ voxy \ app \ return \ index.php (3): SoapClient-> __ call ('call', Array) # 1 C: \ GitHub \ voxy \ app \ return \ index.php (3): SoapClient-> call ('info') # 2 {main} thrown in C: \ GitHub \ voxy \ app \ return \ index.php on line 3
There seems to be a conflict between NuSoap and SOAP, so I read.
If I switch calls, to nusoap_client
in the client call, resolves.
But I really wanted to know where the problem is, and what's the difference between them?