1

I'm trying to get a SOAP web service to run with PHP. But when i am running the file the page shows nothing. I tried to create a client to see if the code runs that way but the function doesn't run. Here is my code:

webservice.php

function hello(){
    echo("hi");
}

$server = new SoapServer(null, array('uri'=>'http://localhost/FutureWB/hello'));
$server->addFunction("hello");
$server->handle();

testweb.php

try{
$client = new SoapClient(null, array(
    'location'=>"http://localhost/FutureWB/functions/webservice.php",
    'uri' => "http://localhost/FutureWB/hello"

));

$result = $client->hello();
echo($result);


}catch(SoapFault $ex){
    $ex->getMessage();
}
2
  • check with firebug , what is the error you are getting Commented Aug 17, 2013 at 11:14
  • There are no errors given. Just a blank page Commented Aug 17, 2013 at 11:15

1 Answer 1

2

Sorry not a great SoapClient user but how about this,

function hello(){
    return "hi";
}
Sign up to request clarification or add additional context in comments.

2 Comments

Wait sorry. This does indeed fix it. Thanks alot!
GR8, glad I helped, one of the keys to Soap development seems to be working out how to set up logging on the Client and the Server, else it can threaten you sanity. I'm fine now, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.