Skip to content

SoapServer returns Internal Server Error (no log) in Laravel 5.2 #13672

Closed
@farhoudi

Description

@farhoudi

I'm trying to run soap server in laravel 5.2. I create wsdl file using piotrooi/wsdl-creator and create SoapServer object then handle it.
And my SoapClient can call it but returns an Internal Server Error Without logging in error-log file.
Here is my code:

<?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}";
    }
}

And my WSDL file: WSDL
And my routes:

Route::any('/server', 'SoapController@server');
Route::any('/client', 'SoapController@client');

There is no problem with wsdl-creator, 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 SoapServer is not working well in Laravel 5.2. (I have tried my code in pure PHP script with namespaces and it is working)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions