I created a simple web-service and i want JQuery to be able to use the webservice. The webservice has no XML output or JSON output so i have no clue how to set that up with JQuery. The webservice works fine with PHP though. I have tried to change the header of page to xml and JSON: ("Content-Type:text/xml"); and header('Content-type: application/json');
How do i set it up so JQuery can use the webservice?
Here is the full code:
SoapServer.php
header('Content-type: application/json');
function hello($name){
return("hi" . $name);
}
$server = new SoapServer(null, array('uri'=>'http://localhost/PHPWebService/hello'));
$server->addFunction("hello");
$server->handle();
?>
SoapClient.php
<?php
try{
$client = new SoapClient(null, array(
'location'=>"http://localhost/PHPWebService/SoapServer.php",
'uri' => "http://localhost/PHPWebService/hello"
));
$result = $client->hello("Bob");
echo($result);
}catch(SoapFault $ex){
$ex->getMessage();
}
?>