I'm trying to create a soap server in laravel 5.2. This is my code:
Content of SoapController.php:
<?php namespace Giant\Http\Controllers; class SoapController extends Controller { public function __construct() { parent::__construct(); ini_set('soap.wsdl_cache_enabled', 0); ini_set('soap.wsdl_cache_ttl', 0); ini_set('default_socket_timeout', 300); ini_set('max_execution_time', 0); } public function server() { $location = url('server'); // http://payment.dev/server $namespace = $location; $class = "\\Giant\\Http\\Controllers\\HelloWorld"; $wsdl = new \WSDL\WSDLCreator($class, $location); $wsdl->setNamespace($namespace); if (isset($_GET['wsdl'])) { $wsdl->renderWSDL(); exit; } $wsdl->renderWSDLService(); $wsdlUrl = url('wsdl/server.wsdl'); $server = new \SoapServer( url('server?wsdl'), array( 'exceptions' => 1, 'trace' => 1, ) ); $server->setClass($class); $server->handle(); exit; } public function client() { $wsdl = url('server?wsdl'); $client = new \SoapClient($wsdl); try { $res = $client->hello('world'); dd($res); } catch (\Exception $ex) { dd($ex); } } } class HelloWorld { /** * @WebMethod * @desc Hello Web-Service * @param string $name * @return string $helloMessage */ public function hello($name) { return "hello {$name}"; } } My wsdl file is: wsdl
And my routes:
Route::any('/server', 'SoapController@server'); Route::any('/client', 'SoapController@client'); And the result I get:
Internal Server Error :(
I use piotrooo/wsdl-creator to generate wsdl. (There is no problem with that, It is working in laravel 4.2). And I have also tried nusoap and php2wsdl libraries.
My SoapClient is working well. Because it can get service from other soap servers in other urls, But I think my SoapServer can not work well.
I even get no errors in error-log file.
array( 'exceptions' => 1, 'trace' => 1, )should bearray( 'exceptions' => 1, 'trace' => 1 ). If this is why you get an error then i should convert this comment to an answer.